Fixed 'PackageInternalsFinder.fuse' throws an exception when jar in jar is empty (#2941)

This commit is contained in:
西东 2024-11-13 14:30:01 +08:00 committed by GitHub
parent 8200afb3cc
commit 6605b4abe3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -98,6 +98,9 @@ public class PackageInternalsFinder {
JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
String rootEntryName = jarConn.getEntryName();
if (rootEntryName != null) {
//可能为 null自己没有类文件时
int rootEnd = rootEntryName.length() + 1;
Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
@ -112,6 +115,7 @@ public class PackageInternalsFinder {
result.add(new CustomJavaFileObject(binaryName, uri));
}
}
}
} catch (Exception e) {
throw new RuntimeException("Wasn't able to open " + packageFolderURL + " as a jar file", e);
}