mirror of
https://gitee.com/arthas/arthas.git
synced 2024-11-29 18:58:37 +08:00
Fixed 'PackageInternalsFinder.fuse' throws an exception when jar in jar is empty (#2941)
This commit is contained in:
parent
8200afb3cc
commit
6605b4abe3
@ -98,18 +98,22 @@ public class PackageInternalsFinder {
|
|||||||
|
|
||||||
JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
|
JarURLConnection jarConn = (JarURLConnection) packageFolderURL.openConnection();
|
||||||
String rootEntryName = jarConn.getEntryName();
|
String rootEntryName = jarConn.getEntryName();
|
||||||
int rootEnd = rootEntryName.length() + 1;
|
|
||||||
|
|
||||||
Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
|
if (rootEntryName != null) {
|
||||||
while (entryEnum.hasMoreElements()) {
|
//可能为 null(自己没有类文件时)
|
||||||
JarEntry jarEntry = entryEnum.nextElement();
|
int rootEnd = rootEntryName.length() + 1;
|
||||||
String name = jarEntry.getName();
|
|
||||||
if (name.startsWith(rootEntryName) && name.indexOf('/', rootEnd) == -1 && name.endsWith(CLASS_FILE_EXTENSION)) {
|
|
||||||
URI uri = URI.create(jarUri + "!/" + name);
|
|
||||||
String binaryName = name.replaceAll("/", ".");
|
|
||||||
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
|
|
||||||
|
|
||||||
result.add(new CustomJavaFileObject(binaryName, uri));
|
Enumeration<JarEntry> entryEnum = jarConn.getJarFile().entries();
|
||||||
|
while (entryEnum.hasMoreElements()) {
|
||||||
|
JarEntry jarEntry = entryEnum.nextElement();
|
||||||
|
String name = jarEntry.getName();
|
||||||
|
if (name.startsWith(rootEntryName) && name.indexOf('/', rootEnd) == -1 && name.endsWith(CLASS_FILE_EXTENSION)) {
|
||||||
|
URI uri = URI.create(jarUri + "!/" + name);
|
||||||
|
String binaryName = name.replaceAll("/", ".");
|
||||||
|
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
|
||||||
|
|
||||||
|
result.add(new CustomJavaFileObject(binaryName, uri));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user