Skip to content

Commit b507667

Browse files
committed
Retry zip files more aggressively
This doesn't fix any issue, but may be useful in some cases, I guess?
1 parent 6e6502b commit b507667

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/main/java/the/bytecode/club/bytecodeviewer/resources/ResourceContainerImporter.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,18 @@ public ResourceContainerImporter importAsZip() throws IOException
7373
try
7474
{
7575
//attempt to import using Java ZipInputStream
76-
importZipInputStream(false);
76+
return importZipInputStream(false);
7777
}
78-
catch (IOException e)
78+
catch (Throwable t)
7979
{
80-
e.printStackTrace();
81-
82-
//fallback to apache commons ZipFile
83-
importApacheZipFile(false);
80+
try {
81+
//fallback to apache commons ZipFile
82+
return importApacheZipFile(false);
83+
} catch (Throwable t1) {
84+
t1.addSuppressed(t);
85+
throw t1;
86+
}
8487
}
85-
return this;
8688
}
8789

8890
/**
@@ -93,10 +95,10 @@ public ResourceContainerImporter addUnknownFile(String name, InputStream stream,
9395
{
9496
//TODO remove this .class check and just look for cafebabe
9597
if (name.endsWith(".class"))
96-
addClassResource(name, stream);
97-
else if(!classesOnly)
98-
addResource(name, stream);
99-
98+
return addClassResource(name, stream);
99+
else if (!classesOnly)
100+
return addResource(name, stream);
101+
100102
return this;
101103
}
102104

0 commit comments

Comments
 (0)