Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3.3 leaks Deflate resource on Android #3

Closed
gregkorossy opened this issue Jun 15, 2019 · 2 comments
Closed

1.3.3 leaks Deflate resource on Android #3

gregkorossy opened this issue Jun 15, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gregkorossy
Copy link

Calling zipFile.addStream(inputStream, zipParameters) calls zipEngine.addStreamToZip(...) which creates a ZipOutputStream which is a DeflaterOutputStream that has a Deflate member. This Deflate member should be closed using the end() method which is never called.

@srikanth-lingala srikanth-lingala self-assigned this Jun 16, 2019
@richstokes129
Copy link

This has issue has also been found on 1.3.2 and 1.3.3 on createZipFileFromFolder(...), addFolder(...), addFiles(....)

Stack trace from 1.3.3 with Strict mode enable with detectLeakedClosableObjects() turned on:

E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'end' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:223)
at java.util.zip.Deflater.(Deflater.java:173)
at java.util.zip.Deflater.(Deflater.java:190)
at net.lingala.zip4j.io.DeflaterOutputStream.(DeflaterOutputStream.java:38)
at net.lingala.zip4j.io.ZipOutputStream.(ZipOutputStream.java:15)
at net.lingala.zip4j.zip.ZipEngine.initAddFiles(ZipEngine.java:114)
at net.lingala.zip4j.zip.ZipEngine.addFiles(ZipEngine.java:85)
at net.lingala.zip4j.zip.ZipEngine.addFolderToZip(ZipEngine.java:297)
at net.lingala.zip4j.core.ZipFile.addFolder(ZipFile.java:356)
at net.lingala.zip4j.core.ZipFile.createZipFileFromFolder(ZipFile.java:236)

@srikanth-lingala
Copy link
Owner

Fixed in version 2.0 released today (it might be a few hours before the version is synced to maven central).

Please note that v2.0 is a major change from the previous versions. Please have a look at the usage section of the readme for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants