Skip to content

Commit

Permalink
Merge pull request #228 from kbss-cvut/bug#227-classpath-scanning-boo…
Browse files Browse the repository at this point in the history
…t-3.2

[Bug #227] Support new Spring Boot JAR structure when scanning classpath
  • Loading branch information
ledsoft authored Jan 30, 2024
2 parents 51f9bf9 + f424acd commit 4150aec
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
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 4150aec

Please sign in to comment.