Author: bodewig
Date: Sat Jun 16 08:10:27 2012
New Revision: 1350883
URL: http://svn.apache.org/viewvc?rev=1350883&view=rev
Log:
Properly expand bzip2 files with multiple streams in <bunzip2>
Added:
ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml (with props)
ant/core/trunk/src/tests/antunit/taskdefs/bzip2/
ant/core/trunk/src/tests/antunit/taskdefs/bzip2/expected
ant/core/trunk/src/tests/antunit/taskdefs/bzip2/multiple.bz2
- copied unchanged from r1348527,
commons/proper/compress/trunk/src/test/resources/multiple.bz2
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
Modified: ant/core/trunk/WHATSNEW
URL:
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1350883&r1=1350882&r2=1350883&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Sat Jun 16 08:10:27 2012
@@ -55,6 +55,9 @@ Other changes:
* merged the BZIP2 package from Commons Compress, it can now
optionally read files that contain multiple streams properly.
+ * <bunzip2> 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
===================================
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java?rev=1350883&r1=1350882&r2=1350883&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java Sat Jun
16 08:10:27 2012
@@ -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 {
Added: ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml?rev=1350883&view=auto
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml Sat Jun 16
08:10:27 2012
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
+ <import file="../antunit-base.xml" />
+
+ <target name="testExpandArchiveWithMultipleStreams">
+ <mkdir dir="${output}"/>
+ <bunzip2 src="bzip2/multiple.bz2" dest="${output}"/>
+ <au:assertFilesMatch expected="bzip2/expected"
+ actual="${output}/multiple"/>
+ </target>
+
+</project>
\ No newline at end of file
Propchange: ant/core/trunk/src/tests/antunit/taskdefs/bunzip2-test.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ant/core/trunk/src/tests/antunit/taskdefs/bzip2/expected
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/bzip2/expected?rev=1350883&view=auto
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/bzip2/expected (added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/bzip2/expected Sat Jun 16
08:10:27 2012
@@ -0,0 +1 @@
+ab
\ No newline at end of file