Browse Source

Encode hash symbol in jar file path (for compatibility with JDK 11+)

Closes gh-26104

(cherry picked from commit b29723623b)
pull/26273/head
Juergen Hoeller 5 years ago
parent
commit
4e720e8104
  1. 3
      spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

3
spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

@ -432,6 +432,9 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol @@ -432,6 +432,9 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
// Possibly "c:" drive prefix on Windows, to be upper-cased for proper duplicate detection
filePath = StringUtils.capitalize(filePath);
}
// # can appear in directories/filenames, java.net.URL should not treat it as a fragment
filePath = StringUtils.replace(filePath, "#", "%23");
// Build URL that points to the root of the jar file
UrlResource jarResource = new UrlResource(ResourceUtils.JAR_URL_PREFIX +
ResourceUtils.FILE_URL_PREFIX + filePath + ResourceUtils.JAR_URL_SEPARATOR);
// Potentially overlapping with URLClassLoader.getURLs() result above!

Loading…
Cancel
Save