srikanth-lingala / zip4j

A Java library for zip files and streams
Apache License 2.0
2.09k stars 313 forks source link

When using JDK's zipInputStream to decorate zip4j, due to the CRC32 mechanism, a close stream exception will be generated #515

Closed laglangyue closed 1 year ago

laglangyue commented 1 year ago

1 Use JDK zipInputStream to writer a paraent zipFile which contains some zipFile. 2 use zip4j open this zip,and use JDK zipInputStream open the inner zipFile,when close zipInputSteam. it exceptioned.

Suppressed: java.io.IOException: invalid CRC for file: 74193495856f4761b60d035d64e3c408/resource/bca7e8181b00455fa33ee988f7b73bb9-all.zip
        at net.lingala.zip4j.io.ZipInputStream.close(ZipInputStream.java:77)
        at net.lingala.zip4j.io.ZipInputStream.close(ZipInputStream.java:60)
laglangyue commented 1 year ago

image because the JDK will use close() method

laglangyue commented 1 year ago

I'm not sure if this can be optimized, should CRC be verified by default

laglangyue commented 1 year ago

I find my version is 1.x,but now it support 2.x. I think 2. x should no longer have this issue.