From b817fdb2b8ab9d8e62004957b7913cab17d5d01f Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 16 Jun 2012 08:10:27 +0000 Subject: [PATCH] Properly expand bzip2 files with multiple streams in git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1350883 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 ++ .../apache/tools/ant/taskdefs/BUnzip2.java | 2 +- src/tests/antunit/taskdefs/bunzip2-test.xml | 28 ++++++++++++++++++ src/tests/antunit/taskdefs/bzip2/expected | 1 + src/tests/antunit/taskdefs/bzip2/multiple.bz2 | Bin 0 -> 74 bytes 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/tests/antunit/taskdefs/bunzip2-test.xml create mode 100644 src/tests/antunit/taskdefs/bzip2/expected create mode 100644 src/tests/antunit/taskdefs/bzip2/multiple.bz2 diff --git a/WHATSNEW b/WHATSNEW index ef140703c..a86cdab84 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -55,6 +55,9 @@ Other changes: * merged the BZIP2 package from Commons Compress, it can now optionally read files that contain multiple streams properly. + * will now properly expand files created by pbzip2 and + similar tools that create files with multiple bzip2 streams. + Changes from Ant 1.8.3 TO Ant 1.8.4 =================================== diff --git a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java index 2f13626b9..0129fea2f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -75,7 +75,7 @@ public class BUnzip2 extends Unpack { if (b != 'Z') { throw new BuildException("Invalid bz2 file.", getLocation()); } - zIn = new CBZip2InputStream(bis); + zIn = new CBZip2InputStream(bis, true); byte[] buffer = new byte[BUFFER_SIZE]; int count = 0; do { diff --git a/src/tests/antunit/taskdefs/bunzip2-test.xml b/src/tests/antunit/taskdefs/bunzip2-test.xml new file mode 100644 index 000000000..a9ca42376 --- /dev/null +++ b/src/tests/antunit/taskdefs/bunzip2-test.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/tests/antunit/taskdefs/bzip2/expected b/src/tests/antunit/taskdefs/bzip2/expected new file mode 100644 index 000000000..9ae9e86b7 --- /dev/null +++ b/src/tests/antunit/taskdefs/bzip2/expected @@ -0,0 +1 @@ +ab \ No newline at end of file diff --git a/src/tests/antunit/taskdefs/bzip2/multiple.bz2 b/src/tests/antunit/taskdefs/bzip2/multiple.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..26dc3a750fafbc496d05d855492b0ada696adb59 GIT binary patch literal 74 zcmZ>Y%CIzaj8qGbl$<;}n}LCWkwF0n6(!u7-gzwN5@I$g&P{NFD-yY|cN18V0J0*c IS>oFq0KZ@pJ^%m! literal 0 HcmV?d00001