|
40 | 40 | import java.util.Collections;
|
41 | 41 | import java.util.Enumeration;
|
42 | 42 | import java.util.HashSet;
|
| 43 | +import java.util.Iterator; |
43 | 44 | import java.util.LinkedHashSet;
|
44 | 45 | import java.util.Map;
|
45 | 46 | import java.util.NavigableSet;
|
@@ -806,7 +807,7 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
|
806 | 807 | if (separatorIndex == -1) {
|
807 | 808 | separatorIndex = urlFile.indexOf(ResourceUtils.JAR_URL_SEPARATOR);
|
808 | 809 | }
|
809 |
| - if (separatorIndex != -1) { |
| 810 | + if (separatorIndex >= 0) { |
810 | 811 | jarFileUrl = urlFile.substring(0, separatorIndex);
|
811 | 812 | rootEntryPath = urlFile.substring(separatorIndex + 2); // both separators are 2 chars
|
812 | 813 | NavigableSet<String> entriesCache = this.jarEntriesCache.get(jarFileUrl);
|
@@ -874,7 +875,13 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
|
874 | 875 | }
|
875 | 876 | Set<Resource> result = new LinkedHashSet<>(64);
|
876 | 877 | NavigableSet<String> entriesCache = new TreeSet<>();
|
877 |
| - for (String entryPath : jarFile.stream().map(JarEntry::getName).sorted().toList()) { |
| 878 | + Iterator<String> entryIterator = jarFile.stream().map(JarEntry::getName).sorted().iterator(); |
| 879 | + while (entryIterator.hasNext()) { |
| 880 | + String entryPath = entryIterator.next(); |
| 881 | + int entrySeparatorIndex = entryPath.indexOf(ResourceUtils.JAR_URL_SEPARATOR); |
| 882 | + if (entrySeparatorIndex >= 0) { |
| 883 | + entryPath = entryPath.substring(entrySeparatorIndex + ResourceUtils.JAR_URL_SEPARATOR.length()); |
| 884 | + } |
878 | 885 | entriesCache.add(entryPath);
|
879 | 886 | if (entryPath.startsWith(rootEntryPath)) {
|
880 | 887 | String relativePath = entryPath.substring(rootEntryPath.length());
|
|
0 commit comments