git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277688 13f79535-47bb-0310-9956-ffa450edef68master
@@ -325,6 +325,9 @@ Fixed bugs: | |||||
* <zip>'s defaultexcludes attribute was ignored when an archive was | * <zip>'s defaultexcludes attribute was ignored when an archive was | ||||
updated. Bugzilla Report 33412. | updated. Bugzilla Report 33412. | ||||
* <zip> couldn't store files with size between 2GB and 4GB (the | |||||
upper limit set by the ZIP format itself). Bugzilla Report 33310. | |||||
Changes from Ant 1.6.1 to Ant 1.6.2 | Changes from Ant 1.6.1 to Ant 1.6.2 | ||||
=================================== | =================================== | ||||
@@ -336,8 +336,8 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
deflate(); | deflate(); | ||||
} | } | ||||
entry.setSize(def.getTotalIn()); | |||||
entry.setComprSize(def.getTotalOut()); | |||||
entry.setSize(adjustToLong(def.getTotalIn())); | |||||
entry.setComprSize(adjustToLong(def.getTotalOut())); | |||||
entry.setCrc(realCrc); | entry.setCrc(realCrc); | ||||
def.reset(); | def.reset(); | ||||
@@ -877,4 +877,19 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
out.write(data, offset, length); | out.write(data, offset, length); | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Assumes a negative integer really is a positive integer that | |||||
* has wrapped around and re-creates the original value. | |||||
* | |||||
* @since 1.34 | |||||
*/ | |||||
protected static long adjustToLong(int i) { | |||||
if (i < 0) { | |||||
return 2 * ((long) Integer.MAX_VALUE) + 2 + i; | |||||
} else { | |||||
return i; | |||||
} | |||||
} | |||||
} | } |
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2004 The Apache Software Foundation | |||||
* Copyright 2004-2005 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -66,4 +66,13 @@ public class ZipOutputStreamTest extends TestCase { | |||||
assertEquals(test.getValue(), zl.getValue()); | assertEquals(test.getValue(), zl.getValue()); | ||||
} | } | ||||
public void testAdjustToLong() { | |||||
assertEquals((long) Integer.MAX_VALUE, | |||||
ZipOutputStream.adjustToLong(Integer.MAX_VALUE)); | |||||
assertEquals(((long) Integer.MAX_VALUE) + 1, | |||||
ZipOutputStream.adjustToLong(Integer.MAX_VALUE + 1)); | |||||
assertEquals(2 * ((long) Integer.MAX_VALUE), | |||||
ZipOutputStream.adjustToLong(2 * Integer.MAX_VALUE)); | |||||
} | |||||
} | } |