Skip to content

Commit

Permalink
Ignore entries cache if no matching root entry path found
Browse files Browse the repository at this point in the history
Closes gh-34446
  • Loading branch information
jhoeller committed Feb 23, 2025
1 parent 5a0bd9e commit 725b02a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -816,17 +816,21 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
// Clean root entry path to match jar entries format without "!" separators
rootEntryPath = rootEntryPath.replace(ResourceUtils.JAR_URL_SEPARATOR, "/");
// Search sorted entries from first entry with rootEntryPath prefix
boolean rootEntryPathFound = false;
for (String entryPath : entriesCache.tailSet(rootEntryPath, false)) {
if (!entryPath.startsWith(rootEntryPath)) {
// We are beyond the potential matches in the current TreeSet.
break;
}
rootEntryPathFound = true;
String relativePath = entryPath.substring(rootEntryPath.length());
if (getPathMatcher().match(subPattern, relativePath)) {
result.add(rootDirResource.createRelative(relativePath));
}
}
return result;
if (rootEntryPathFound) {
return result;
}
}
}

Expand Down

0 comments on commit 725b02a

Please sign in to comment.