Browse Source

create useable output even if the input is empty. PR 45836. Submitted by Tom May.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@697122 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
bc22c6a47f
4 changed files with 17 additions and 14 deletions
  1. +3
    -2
      CONTRIBUTORS
  2. +3
    -3
      WHATSNEW
  3. +4
    -0
      contributors.xml
  4. +7
    -9
      src/main/org/apache/tools/bzip2/CBZip2OutputStream.java

+ 3
- 2
CONTRIBUTORS View File

@@ -274,7 +274,6 @@ Steven E. Newton
Takashi Okamoto Takashi Okamoto
Taoufik Romdhane Taoufik Romdhane
Tariq Master Tariq Master
Trejkaz Xaoza
Thomas Aglassinger Thomas Aglassinger
Thomas Butz Thomas Butz
Thomas Christen Thomas Christen
@@ -283,13 +282,15 @@ Thomas Haas
Thomas Quas Thomas Quas
Tim Drury Tim Drury
Tim Fennell Tim Fennell
Timothy Gerard Endres
Tim Stephenson Tim Stephenson
Timothy Gerard Endres
Tom Ball Tom Ball
Tom Brus Tom Brus
Tom Cunningham Tom Cunningham
Tom Dimock Tom Dimock
Tom Eugelink Tom Eugelink
Tom May
Trejkaz Xaoza
Ulrich Schmidt Ulrich Schmidt
Victor Toni Victor Toni
Vincent Legoll Vincent Legoll


+ 3
- 3
WHATSNEW View File

@@ -56,7 +56,7 @@ Changes that could break older environments:


* CBZip2InputStream will now throw an IOException if * CBZip2InputStream will now throw an IOException if
passed in a null or empty InputStream to read from. passed in a null or empty InputStream to read from.
Bugzilla Report 32200
Bugzilla Reports 32200.


* <unzip> will now fail when trying to extract certain broken * <unzip> will now fail when trying to extract certain broken
archives that would have been silently ignored in earlier version. archives that would have been silently ignored in earlier version.
@@ -166,9 +166,9 @@ Fixed bugs:


* CBZip2OutputStream threw an exception if it was closed prior to * CBZip2OutputStream threw an exception if it was closed prior to
writing anything. writing anything.
Bugzilla Report 32200
Bugzilla Reports 32200, 45836


* The IPlanetDeploymentToll didn't use the configured DTD locations.
* The IPlanetDeploymentTool didn't use the configured DTD locations.
Bugzilla Report 31876. Bugzilla Report 31876.


* The ant shell script printed a warning unser Cygwin if JAVA_HOME * The ant shell script printed a warning unser Cygwin if JAVA_HOME


+ 4
- 0
contributors.xml View File

@@ -1167,6 +1167,10 @@
<first>Tom</first> <first>Tom</first>
<last>Eugelink</last> <last>Eugelink</last>
</name> </name>
<name>
<first>Tom</first>
<last>May</last>
</name>
<name> <name>
<first>Trejkaz</first> <first>Trejkaz</first>
<last>Xaoz</last> <last>Xaoz</last>


+ 7
- 9
src/main/org/apache/tools/bzip2/CBZip2OutputStream.java View File

@@ -434,6 +434,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
combinedCRC = (combinedCRC << 1) | (combinedCRC >>> 31); combinedCRC = (combinedCRC << 1) | (combinedCRC >>> 31);
combinedCRC ^= blockCRC; combinedCRC ^= blockCRC;


// If the stream was empty we must skip the rest of this method.
// See bug#32200.
if (last == -1) {
return;
}
/* sort the block and establish posn of original string */ /* sort the block and establish posn of original string */
doReversibleTransformation(); doReversibleTransformation();


@@ -1131,15 +1137,7 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants {
*/ */


// if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" ); // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" );
// set last to zero in case it's never been set before
// see bug#32200, initBlock is the real culprit
// setting last to -1, but not sure if this -1 is important
// in normal scheme
if (last < 0) {
last = 0;
}

for (i = 0; i < NUM_OVERSHOOT_BYTES; i++) { for (i = 0; i < NUM_OVERSHOOT_BYTES; i++) {
block[last + i + 2] = block[(i % (last + 1)) + 1]; block[last + i + 2] = block[(i % (last + 1)) + 1];
} }


Loading…
Cancel
Save