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 org.apache.tools.zip.ZipOutputStream.createCentralFileHeader(ZipOutputStream.java:1264) > at org.apache.tools.zip.ZipOutputStream.createCentralFileHeader(ZipOutputStream.java:1178) > at org.apache.tools.zip.ZipOutputStream.writeCentralDirectoryInChunks(ZipOutputStream.java:513) > at org.apache.tools.zip.ZipOutputStream.finish(ZipOutputStream.java:498) > at org.apache.tools.zip.ZipOutputStream.close(ZipOutputStream.java:940) > at com.pbmassoc.nsiv.util.ZipDMs.zipFlattenDMs(ZipDMs.java:102) > at com.pbmassoc.nsiv.util.ZipDMs.main(ZipDMs.java:174) > ...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/ZipOutputStream.java: 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. --ewh --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org