Sort library JARs by last modified time
Newer JARs should have more recent mtimes than older JARs that supply the same classes. Try to favor the newer versions by sorting first by mtime and then by name. Bug: issue 1870 Change-Id: I783ab01c070914e02384413e0f5461a9c29a2a70
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.pgm.util;
|
||||
|
||||
import com.google.common.primitives.Longs;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.server.config.SitePaths;
|
||||
import com.google.gerrit.server.schema.DataSourceProvider;
|
||||
@@ -66,6 +67,11 @@ public class SiteLibraryBasedDataSourceProvider extends DataSourceProvider {
|
||||
Arrays.sort(jars, new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File a, File b) {
|
||||
// Sort by reverse last-modified time so newer JARs are first.
|
||||
int cmp = Longs.compare(b.lastModified(), a.lastModified());
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
return a.getName().compareTo(b.getName());
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user