ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Earl Hood <>
Subject Re: ZipOutputStream exception in Ant 1.9.5 and 1.9.6
Date Tue, 21 Jul 2015 02:23:13 GMT
On Mon, Jul 20, 2015 at 3:56 PM, I wrote:

> I have a program that uses Ant's ZipOutputStream class, and it has had
> no problems with versions of Ant 1.9.4 and earlier.  However, with Ant
> 1.9.5 and 1.9.6, I get the following exception:
>   java.lang.ArrayIndexOutOfBoundsException
>     at java.lang.System.arraycopy(Native Method)
>     at
>     at
>     at
>     at
>     at
>     at com.pbmassoc.nsiv.util.ZipDMs.zipFlattenDMs(
>     at com.pbmassoc.nsiv.util.ZipDMs.main(
>     ...snip...

I believe I found the source of the problem.  The problem is in the
createCentralFileHeader() method on line 1261 of

        int commentStart = extraStart + commentLen;

I think it should be:

        int commentStart = extraStart + extra.length;

When I made the change in the 1.9.6 source bundle and built from source,
I no longer got the error and the zip file created verifies with unzip
and 7zip.

It appears that Ant's core code never calls ZipEntry.setComment(), hence
this bug was overlooked.

Since the project I am on requires the ability to work with official
releases of Ant, I will comment out the setComment() call in the project
code; comments are not needed for our application to function.

Hopefully, the above change can be incorporated into the Ant codebase.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message