commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1154818 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
Date Mon, 08 Aug 2011 04:41:15 GMT
Author: bodewig
Date: Mon Aug  8 04:41:15 2011
New Revision: 1154818

URL: http://svn.apache.org/viewvc?rev=1154818&view=rev
Log:
Bzip2CompressorInputStream never called count() - reported by Lasse Collin

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java

Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1154818&r1=1154817&r2=1154818&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Mon Aug  8 04:41:15 2011
@@ -46,6 +46,10 @@ The <action> type attribute can be add,u
   <body>
     <release version="1.3" date="unreleased"
              description="Release 1.3 - API compatible to 1.2 but requires Java5 at runtime">
+      <action type="fix" date="2011-08-08">
+        BZip2CompressorInputStream' getBytesRead method always
+        returned 0.
+      </action> 
       <action issue="COMPRESS-152" type="fix" date="2011-08-03">
         ZipArchiveInputStream and ZipArchiveOutputStream could leak
         resources on some JDKs.

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java?rev=1154818&r1=1154817&r2=1154818&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors/bzip2/BZip2CompressorInputStream.java
Mon Aug  8 04:41:15 2011
@@ -116,7 +116,9 @@ public class BZip2CompressorInputStream 
     @Override
     public int read() throws IOException {
         if (this.in != null) {
-            return read0();
+            int r = read0();
+            count(r < 0 ? -1 : 1);
+            return r;
         } else {
             throw new IOException("stream closed");
         }
@@ -150,7 +152,9 @@ public class BZip2CompressorInputStream 
             dest[destOffs++] = (byte) b;
         }
 
-        return (destOffs == offs) ? -1 : (destOffs - offs);
+        int c = (destOffs == offs) ? -1 : (destOffs - offs);
+        count(c);
+        return c;
     }
 
     private void makeMaps() {



Mime
View raw message