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

DataFormatException: invalid stored block lengths #110

Closed
farrukhnajmi opened this issue Nov 24, 2019 · 6 comments
Closed

DataFormatException: invalid stored block lengths #110

farrukhnajmi opened this issue Nov 24, 2019 · 6 comments
Assignees

Comments

@farrukhnajmi
Copy link

Thanks for a great library.

Using latest version 2.2.4 of zip4j, I am using the following code to extract a zip file:

        ZipFile zipFile = new ZipFile(assetFile);
        zipFile.extractAll(assetExtractionFolder.getAbsolutePath());

and getting the following exception. Note zip file opens fine with zip command in my Ubuntu 18.04 laptop.

net.lingala.zip4j.exception.ZipException: java.io.IOException: java.util.zip.DataFormatException: invalid stored block lengths
	at net.lingala.zip4j.tasks.AsyncZipTask.performTaskWithErrorHandling(AsyncZipTask.java:49) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AsyncZipTask.execute(AsyncZipTask.java:36) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.ZipFile.extractAll(ZipFile.java:437) ~[zip4j-2.2.4.jar:?]
	at ....
Caused by: java.io.IOException: java.util.zip.DataFormatException: invalid stored block lengths
	at net.lingala.zip4j.io.inputstream.InflaterInputStream.read(InflaterInputStream.java:52) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:155) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:127) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.readUntilEndOfEntry(ZipInputStream.java:325) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.getNextEntry(ZipInputStream.java:84) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AbstractExtractFileTask.verifyNextEntry(AbstractExtractFileTask.java:81) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AbstractExtractFileTask.extractFile(AbstractExtractFileTask.java:47) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.ExtractAllFilesTask.executeTask(ExtractAllFilesTask.java:36) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.ExtractAllFilesTask.executeTask(ExtractAllFilesTask.java:13) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AsyncZipTask.performTaskWithErrorHandling(AsyncZipTask.java:42) ~[zip4j-2.2.4.jar:?]
	... 23 more
Caused by: java.util.zip.DataFormatException: invalid stored block lengths
	at java.util.zip.Inflater.inflateBytesBytes(Native Method) ~[?:?]
	at java.util.zip.Inflater.inflate(Inflater.java:378) ~[?:?]
	at net.lingala.zip4j.io.inputstream.InflaterInputStream.read(InflaterInputStream.java:42) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:155) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:127) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.readUntilEndOfEntry(ZipInputStream.java:325) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.io.inputstream.ZipInputStream.getNextEntry(ZipInputStream.java:84) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AbstractExtractFileTask.verifyNextEntry(AbstractExtractFileTask.java:81) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AbstractExtractFileTask.extractFile(AbstractExtractFileTask.java:47) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.ExtractAllFilesTask.executeTask(ExtractAllFilesTask.java:36) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.ExtractAllFilesTask.executeTask(ExtractAllFilesTask.java:13) ~[zip4j-2.2.4.jar:?]
	at net.lingala.zip4j.tasks.AsyncZipTask.performTaskWithErrorHandling(AsyncZipTask.java:42) ~[zip4j-2.2.4.jar:?]
	... 23 more
@farrukhnajmi
Copy link
Author

farrukhnajmi commented Nov 24, 2019

Please download file and then delete attachment for privacy reasons.

Edit from Srikanth: Attachment deleted

@srikanth-lingala
Copy link
Owner

Thanks for the zip file. It will greatly help me investigate the issue. I will update the thread once I find something.

@srikanth-lingala
Copy link
Owner

Issue fixed in v2.2.6 release just now. It might take a few mins to a couple of hours until the version is synced to maven central.

@farrukhnajmi
Copy link
Author

Srikanth you are truly awesome! I am amazed by the responsiveness of this project. Thank you.

@farrukhnajmi
Copy link
Author

Confirming the fix! Thanks again @srikanth-lingala for the awesome help.

@VenkateshPrasadSV
Copy link

I have got this issue on v2.2.7 when I gave the wrong password to extract the zip file.
zip file password is 123, I gave 12jdfkl.

doAsync {
val protectedZip = ZipFile(zipFilePath, zipPassword.toCharArray())
protectedZip.extractAll(extractAt)
mFileList = StorageUtils.instance.getWeBoxFilesAtStorage(extractAt)
uiThread {
setAdapter()
dismissProgressDialog()
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants