Skip to content

Commit 725b02a

Browse files
committed
Ignore entries cache if no matching root entry path found
Closes gh-34446
1 parent 5a0bd9e commit 725b02a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -816,17 +816,21 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
816816
// Clean root entry path to match jar entries format without "!" separators
817817
rootEntryPath = rootEntryPath.replace(ResourceUtils.JAR_URL_SEPARATOR, "/");
818818
// Search sorted entries from first entry with rootEntryPath prefix
819+
boolean rootEntryPathFound = false;
819820
for (String entryPath : entriesCache.tailSet(rootEntryPath, false)) {
820821
if (!entryPath.startsWith(rootEntryPath)) {
821822
// We are beyond the potential matches in the current TreeSet.
822823
break;
823824
}
825+
rootEntryPathFound = true;
824826
String relativePath = entryPath.substring(rootEntryPath.length());
825827
if (getPathMatcher().match(subPattern, relativePath)) {
826828
result.add(rootDirResource.createRelative(relativePath));
827829
}
828830
}
829-
return result;
831+
if (rootEntryPathFound) {
832+
return result;
833+
}
830834
}
831835
}
832836

0 commit comments

Comments
 (0)