Do not include same class path entries from class path property and manifest entries
@@ -70,7 +70,7 @@ public class ClassPathBeanArchiveScanner extends AbstractBeanArchiveScanner {
private static final Pattern MANIFEST_CLASSPATH_SEPARATOR_PATTERN = Pattern.compile(" +");
- private final Set<URL> visitedManifestClassPathEntries = new HashSet<>();
+ private final Set<URL> visitedClassPathEntries = new HashSet<>();
/**
*
@@ -94,6 +94,10 @@ public class ClassPathBeanArchiveScanner extends AbstractBeanArchiveScanner {
continue;
}
File entryFile = new File(entry);
+ try {
+ if (!visitedClassPathEntries.add(entryFile.toURI().toURL())) {
+ continue;
+ }
if (!entryFile.exists()) {
CommonLogger.LOG.classPathEntryDoesNotExist(entryFile);
continue;
@@ -101,7 +105,6 @@ public class ClassPathBeanArchiveScanner extends AbstractBeanArchiveScanner {
if (!entryFile.canRead()) {
throw CommonLogger.LOG.cannotReadClassPathEntry(entryFile);
}
- try {
if (entryFile.isDirectory()) {
scanDirectory(entryFile, results);
} else {
@@ -180,7 +183,7 @@ public class ClassPathBeanArchiveScanner extends AbstractBeanArchiveScanner {
}
try {
URL entryUrl = new URL(context, entry);
- if (visitedManifestClassPathEntries.add(entryUrl) && entryUrl.getProtocol().equals("file")) {
+ if (visitedClassPathEntries.add(entryUrl) && entryUrl.getProtocol().equals("file")) {
File entryFile = new File(URI.create(entryUrl.toString()));
// do not throw an error here, as some libraries use the class path attribute wrongly
if (entryFile.canRead()) {
