Retry zip files more aggressively

This doesn't fix any issue, but may be useful in some cases, I guess?
This commit is contained in:
Nico Mexis 2021-08-05 20:28:32 +02:00
parent 6e6502b300
commit b507667c75
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78

View file

@ -73,16 +73,18 @@ public class ResourceContainerImporter
try try
{ {
//attempt to import using Java ZipInputStream //attempt to import using Java ZipInputStream
importZipInputStream(false); return importZipInputStream(false);
} }
catch (IOException e) catch (Throwable t)
{ {
e.printStackTrace(); try {
//fallback to apache commons ZipFile
//fallback to apache commons ZipFile return importApacheZipFile(false);
importApacheZipFile(false); } catch (Throwable t1) {
t1.addSuppressed(t);
throw t1;
}
} }
return this;
} }
/** /**
@ -93,10 +95,10 @@ public class ResourceContainerImporter
{ {
//TODO remove this .class check and just look for cafebabe //TODO remove this .class check and just look for cafebabe
if (name.endsWith(".class")) if (name.endsWith(".class"))
addClassResource(name, stream); return addClassResource(name, stream);
else if(!classesOnly) else if (!classesOnly)
addResource(name, stream); return addResource(name, stream);
return this; return this;
} }