ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: ZipOutputStream exception in Ant 1.9.5 and 1.9.6
Date Tue, 21 Jul 2015 04:16:49 GMT
On 2015-07-21, Earl Hood wrote:

> 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
> org/apache/tools/zip/

>         int commentStart = extraStart + commentLen;

> I think it should be:

>         int commentStart = extraStart + extra.length;

You are correct.  I'll sit down and review the merged changes
thoroughly once again.

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

... and should only affect people using Ant's zip classes as a library.
We encourage people to use Commons Compress instead.  Of course
Compress' trunk contained the same bug ...

> 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.

It has been committed, many thanks.


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

View raw message