Author Topic: only DEFLATED entries can have EXT descriptor  (Read 12680 times)

Heytherejake

  • Newbie
  • *
  • Posts: 1
    • View Profile
only DEFLATED entries can have EXT descriptor
« on: April 02, 2012, 08:18:00 AM »
I'm trying to patch a Jar file, and whenever I use addFolder, I get this error when I run the patched jar:
Code: [Select]
java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor
at java.util.zip.ZipInputStream.readLOC(Unknown Source)
at java.util.zip.ZipInputStream.getNextEntry(Unknown Source)

Is the folder getting some invalid encryption or compression?

Thanks.

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • View Profile
Re: only DEFLATED entries can have EXT descriptor
« Reply #1 on: April 04, 2012, 10:02:41 AM »
Hi,

Before I talk about your issue, a word of caution: Although Jar is an extension of Zip file format, Zip4j was never tested with Jar files. So, you use it at your own risk.

Regarding your issue: Looks to me like you have been using Java's but not Zip4j's ZipInputStream. Unfortunately, I can't help you much here but googling the error message you got might be helpful for you.

- Srikanth

Himavanth

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: only DEFLATED entries can have EXT descriptor
« Reply #2 on: August 02, 2013, 11:54:53 AM »
Hi Srikanth,

I ran in to this issue today.
It doesn't seem specific to jar files.
For me, it happens if there is a 0 byte file in the zip created by zip4j, and i am trying to read the contents of this zip file using java's ZipInputStream.

Now i am guessing zip4j doesnt do the compression on this file because it is empty but somehow sets some flag which makes java's ZipInputSteam think that it was compressed. I think that's what the error message says.. "only DEFLATED entries can have EXT descriptor".

Now i tried to explicitly set the compression to STORE when the file size that i am zipping is 0 bytes.
                        if(entryFile.length()!=0){
                            zipParams.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
                            zipParams.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
                        }else{
                            zipParams.setCompressionMethod(Zip4jConstants.COMP_STORE);
                        }
But it still doesn't work.
I think this should be fixed for maintaining portability with java's zip classes for non encrypted zip files.

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 403
    • View Profile
Re: only DEFLATED entries can have EXT descriptor
« Reply #3 on: October 25, 2013, 11:22:52 AM »
Quote
0 byte file
That is a good hint. Thanks. Will have a look.