Skip to content

Commit 3033ec6

Browse files
committed
FileUtils#getAllVersions(): respect the classifier!
Without this change, MiniMaven will gladly mistake an artifact with a classifier as conflicting version of an artifact without a classifier. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 743d9a9 commit 3033ec6

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/org/scijava/util/FileUtils.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,22 @@ public static File[] getAllVersions(final File directory,
154154
return file.exists() ? new File[] { file } : null;
155155
}
156156
final String baseName = matcher.group(1);
157+
final String classifier = matcher.group(6);
157158
return directory.listFiles(new FilenameFilter() {
158159

159160
@Override
160161
public boolean accept(final File dir, final String name) {
161162
if (!name.startsWith(baseName)) return false;
162163
final Matcher matcher2 = versionPattern.matcher(name);
163-
return matcher2.matches() && baseName.equals(matcher2.group(1));
164+
return matcher2.matches() && baseName.equals(matcher2.group(1)) &&
165+
equals(classifier, matcher2.group(6));
166+
}
167+
168+
private boolean equals(final String a, final String b) {
169+
if (a == null) {
170+
return b == null;
171+
}
172+
return a.equals(b);
164173
}
165174
});
166175
}

0 commit comments

Comments
 (0)