Bug 1272431 - Do not use API 19+ method for FileLastModifiedComparator. r=ahunt
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 16 May 2016 18:48:42 -0700
changeset 297947 536b16b34e0f0132322cb82f0e0a1554877bbdc0
parent 297946 aba775e7b89cc0e334603aec5e54c6a64ded2d83
child 297948 0e3c3535be0264138fb4fd3d0e85a6b42661e472
push id30268
push userryanvm@gmail.com
push dateThu, 19 May 2016 13:34:05 +0000
treeherdermozilla-central@5a4cdb6dfb19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahunt
bugs1272431
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1272431 - Do not use API 19+ method for FileLastModifiedComparator. r=ahunt MozReview-Commit-ID: 7lN0mJgWYg5
mobile/android/base/java/org/mozilla/gecko/util/FileUtils.java
--- a/mobile/android/base/java/org/mozilla/gecko/util/FileUtils.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/FileUtils.java
@@ -239,12 +239,21 @@ public class FileUtils {
             }
             return mCachedMatcher.matches();
         }
     }
 
     public static class FileLastModifiedComparator implements Comparator<File> {
         @Override
         public int compare(final File lhs, final File rhs) {
-            return Long.compare(lhs.lastModified(), rhs.lastModified());
+            // Long.compare is API 19+.
+            final long lhsModified = lhs.lastModified();
+            final long rhsModified = rhs.lastModified();
+            if (lhsModified < rhsModified) {
+                return -1;
+            } else if (lhsModified == rhsModified) {
+                return 0;
+            } else {
+                return 1;
+            }
         }
     }
 }