Skip to content

Commit

Permalink
#2952 fix: packageURL must startwith java: or nested:
Browse files Browse the repository at this point in the history
In a fat jar, packageURL start with "nested:", 
not a fat jar, it start with "jar:".
  • Loading branch information
wkclz authored Dec 28, 2023
1 parent 47ef71f commit ec7e7b9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ private static List<String> getClassNamesFromPackage(ClassLoader classLoader, St
}

private static void processJarPackage(URL packageURL, String packageName, String pkg, ArrayList<String> names) throws IOException {
logger.info("Loading classes from jar {}", packageURL.getFile());
String jarFileName = URLDecoder.decode(packageURL.getFile(), "UTF-8");
if (!jarFileName.startsWith("jar:") && !jarFileName.startsWith("nested:")) {
logger.error("Loading classes from jar with error packageURL: {}", jarFileName);
}
logger.info("Loading classes from jar {}", jarFileName);
try (JarFile jf = ((JarURLConnection) packageURL.openConnection()).getJarFile()) {
Enumeration<JarEntry> jarEntries = jf.entries();
while (jarEntries.hasMoreElements()) {
Expand Down

0 comments on commit ec7e7b9

Please sign in to comment.