Skip to content

Commit

Permalink
[Bug #227] Support new Spring Boot JAR structure when scanning classp…
Browse files Browse the repository at this point in the history
…ath.
  • Loading branch information
ledsoft committed Jan 30, 2024
1 parent 51f9bf9 commit f424acd
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -105,16 +105,17 @@ protected void processElements(Enumeration<URL> urls, String scanPath) throws IO
* @throws UnsupportedEncodingException Should not happen, using standard UTF-8 encoding
*/
protected static String sanitizePath(URL url) throws UnsupportedEncodingException {
return URLDecoder.decode(url.getFile(), StandardCharsets.UTF_8.toString());
return URLDecoder.decode(url.getFile(), StandardCharsets.UTF_8);
}

protected static boolean isJar(String filePath) {
return filePath.startsWith("jar:") || filePath.endsWith(JAR_FILE_SUFFIX);
}

protected static JarFile createJarFile(URL elementUrl) throws IOException {
final String jarPath = sanitizePath(elementUrl).replaceFirst("[.]jar[!].*", JAR_FILE_SUFFIX)
.replaceFirst("file:", "");
final String jarPath = sanitizePath(elementUrl).replaceFirst("[.]jar/?!.*", JAR_FILE_SUFFIX)
.replaceFirst("file:", "")
.replaceFirst("nested:", "");
return new JarFile(jarPath);
}

Expand Down

0 comments on commit f424acd

Please sign in to comment.