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
1 changed files with 13 additions and 11 deletions

View File

@ -73,16 +73,18 @@ public class ResourceContainerImporter
try
{
//attempt to import using Java ZipInputStream
importZipInputStream(false);
return importZipInputStream(false);
}
catch (IOException e)
catch (Throwable t)
{
e.printStackTrace();
//fallback to apache commons ZipFile
importApacheZipFile(false);
try {
//fallback to apache commons ZipFile
return 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
if (name.endsWith(".class"))
addClassResource(name, stream);
else if(!classesOnly)
addResource(name, stream);
return addClassResource(name, stream);
else if (!classesOnly)
return addResource(name, stream);
return this;
}