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

ZipInputStream did't get all entries for this file #143

Closed
foobnix opened this issue Feb 12, 2020 · 5 comments
Closed

ZipInputStream did't get all entries for this file #143

foobnix opened this issue Feb 12, 2020 · 5 comments
Assignees
Labels
bug Something isn't working resolved

Comments

@foobnix
Copy link

foobnix commented Feb 12, 2020

No description provided.

@foobnix foobnix changed the title ZipInputStream did ZipInputStream did't get all entries for this file Feb 12, 2020
@foobnix
Copy link
Author

foobnix commented Feb 12, 2020

@foobnix foobnix closed this as completed Feb 12, 2020
@foobnix foobnix reopened this Feb 12, 2020
@srikanth-lingala
Copy link
Owner

Which files did zip4j miss to unzip? I used The Unarchiver on mac to unzip your zip file, and the content which was extracted by this tool was the same as the content extracted by zip4j. I also checked with java's inbuilt tool and it was also the same here as well. Which tool did you use to unzip the zip file?

@foobnix
Copy link
Author

foobnix commented Feb 13, 2020

Please test this file with (net.lingala.zip4j.io.inputstream.ZipInputStream) and (net.lingala.zip4j.ZipFile)

public static void test(File file) throws IOException {
        //case 1
        try {
            ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
            LocalFileHeader nextEntry = zis.getNextEntry();
            while (nextEntry != null) {
                LOG.d("Zip-1", nextEntry.getFileName());
                nextEntry = zis.getNextEntry();
            }
            zis.close();
        } catch (Exception e) {
            LOG.e(e, "Zip-1");
        }
        //case 2
        ZipFile zipFile = new ZipFile(file);
        List<FileHeader> fileHeaders = zipFile.getFileHeaders();
        for (FileHeader h : fileHeaders) {
            LOG.d("Zip-2", h.getFileName());
        }


    }

result is different:

// case 1
D/DEBUG ( 1935): Zip-1|mimetype|
D/DEBUG ( 1935): Zip-1|META-INF/|

// case 2
D/DEBUG ( 1935): Zip-2|mimetype|
D/DEBUG ( 1935): Zip-2|META-INF/|
D/DEBUG ( 1935): Zip-2|META-INF/container.xml|
D/DEBUG ( 1935): Zip-2|content.opf|
D/DEBUG ( 1935): Zip-2|cover.jpeg|
D/DEBUG ( 1935): Zip-2|images/|
D/DEBUG ( 1935): Zip-2|images/00001.gif|
D/DEBUG ( 1935): Zip-2|page_styles.css|
D/DEBUG ( 1935): Zip-2|stylesheet.css|
D/DEBUG ( 1935): Zip-2|text/|
D/DEBUG ( 1935): Zip-2|text/part0000.html|
D/DEBUG ( 1935): Zip-2|text/part0001.html|
D/DEBUG ( 1935): Zip-2|text/part0002.html|
D/DEBUG ( 1935): Zip-2|text/part0003.html|
D/DEBUG ( 1935): Zip-2|text/part0004.html|
D/DEBUG ( 1935): Zip-2|text/part0005.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_000.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_001.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_002.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_003.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_004.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_005.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_006.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_007.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_008.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_009.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_010.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_011.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_012.html|
D/DEBUG ( 1935): Zip-2|text/part0006_split_013.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_000.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_001.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_002.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_003.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_004.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_005.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_006.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_007.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_008.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_009.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_010.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_011.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_012.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_013.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_014.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_015.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_016.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_017.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_018.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_019.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_020.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_021.html|
D/DEBUG ( 1935): Zip-2|text/part0007_split_022.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_000.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_001.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_002.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_003.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_004.html|
D/DEBUG ( 1935): Zip-2|text/part0008_split_005.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_000.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_001.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_002.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_003.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_004.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_005.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_006.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_007.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_008.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_009.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_010.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_011.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_012.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_013.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_014.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_015.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_016.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_017.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_018.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_019.html|
D/DEBUG ( 1935): Zip-2|text/part0009_split_020.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_000.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_001.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_002.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_003.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_004.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_005.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_006.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_007.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_008.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_009.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_010.html|
D/DEBUG ( 1935): Zip-2|text/part0010_split_011.html|
D/DEBUG ( 1935): Zip-2|text/part0011.html|
D/DEBUG ( 1935): Zip-2|text/part0012.html|
D/DEBUG ( 1935): Zip-2|titlepage.xhtml|
D/DEBUG ( 1935): Zip-2|toc.ncx|

@srikanth-lingala
Copy link
Owner

Thanks for the sample code. I was able to reproduce it. Working on a fix.

@srikanth-lingala
Copy link
Owner

Fixed in v2.3.2 released today

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

No branches or pull requests

2 participants