Author: bodewig
Date: Fri Sep 19 08:04:54 2008
New Revision: 697122

URL: http://svn.apache.org/viewvc?rev=697122&view=rev
Log:
create useable output even if the input is empty.  PR 45836.  Submitted by Tom 
May.

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=697122&r1=697121&r2=697122&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=697122&r1=697121&r2=697122&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Fri Sep 19 08:04:54 2008
@@ -56,7 +56,7 @@
 
  * CBZip2InputStream will now throw an IOException if
    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
    archives that would have been silently ignored in earlier version.
@@ -166,9 +166,9 @@
 
  * CBZip2OutputStream threw an exception if it was closed prior to
    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.
 
  * The ant shell script printed a warning unser Cygwin if JAVA_HOME

Modified: ant/core/trunk/contributors.xml
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=697122&r1=697121&r2=697122&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Fri Sep 19 08:04:54 2008
@@ -1168,6 +1168,10 @@
     <last>Eugelink</last>
   </name>
   <name>
+    <first>Tom</first>
+    <last>May</last>
+  </name>
+  <name>
     <first>Trejkaz</first>
     <last>Xaoz</last>
   </name>

Modified: ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java?rev=697122&r1=697121&r2=697122&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java Fri 
Sep 19 08:04:54 2008
@@ -434,6 +434,12 @@
         combinedCRC = (combinedCRC << 1) | (combinedCRC >>> 31);
         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 */
         doReversibleTransformation();
 
@@ -1131,15 +1137,7 @@
         */
 
         //   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++) {
             block[last + i + 2] = block[(i % (last + 1)) + 1];
         }


Reply via email to