Skip to content

Commit

Permalink
Encode hash symbol in jar file path (for compatibility with JDK 11+)
Browse files Browse the repository at this point in the history
Closes spring-projectsgh-26104

(cherry picked from commit b297236)
  • Loading branch information
jhoeller committed Nov 17, 2020
1 parent fdab75a commit 4e720e8
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ protected void addClassPathManifestEntries(Set<Resource> result) {
// 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!
Expand Down

0 comments on commit 4e720e8

Please sign in to comment.