Recaf
Recaf copied to clipboard
Give proper user notification for corrupted Jars
In my case I had a jar that had no zip END header, which of course leads to the jar not being usable. However the UI does not make this clear right away (other than the loading freezing very early) and the only thing making this fact apparent is the output of the console. Perhaps maybe give a warning in that case? Example jar that causes this issue (renamed to .zip due to github's file extension limitation; I also own all rights to it) proof-of-concept.zip
If anyone is aware of some ZIP libraries, or any different handling than what we do now (NIO?), for Java that handle this I can take a look at this. The default ZIP classes error out on the constructor, so its not really possible to cleanly work around this.
Crash since it reads the whole file before letting you visit each sub-item
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
For additional context, the zip file is usually comprised of 3 structs:
LocalFileHeader- Has the file contents and metadata
CentralDirectoryFileHeader- Has metadata, which trumps the LocalFileHeader's
EndOfCentralDirectory- Info about number of expected entries
This sample contains only LocalFileHeader entries.
This has been vastly improved in 3x and even more in 4x which even lets you choose between 3 modes of ZIP parsing. Gonna call this done for now.