ZIP-tutorial - unzipping on MACOS fails
First of all - thanks for your Java ZIP tutorial on https://www.baeldung.com/java-compress-and-uncompress.
I run the demo and I could zip multiple files but when trying to unzip the file on MACOS it fails with "error 79".
I think one line of code is missing in https://github.com/eugenp/tutorials/blob/master/core-java-modules/core-java-io/src/main/java/com/baeldung/zip/ZipMultipleFiles.java (I didn't test it but I believe the error will occur as well on ZipDirectory.java and ZipFile.java).
Old code (just the important part):
while ((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
fis.close();
New code (insert just one extra line of code to fix the problem):
while ((length = fis.read(bytes)) >= 0) {
zipOut.write(bytes, 0, length);
}
zipOut.closeEntry();
fis.close();
Greetings Michael
Thanks for the feedback @FlutterCrypto! We'll take a look into this.
Tested on apple M2 and working correct.
@FlutterCrypto, we are unable to reproduce the problem. Can you provide more details on how to replicate the issue?