commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1148806 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
Date Wed, 20 Jul 2011 14:55:51 GMT
Author: bodewig
Date: Wed Jul 20 14:55:50 2011
New Revision: 1148806

URL: http://svn.apache.org/viewvc?rev=1148806&view=rev
Log:
'our' skip method will not return early.  COMPRESS-130

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.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=1148806&r1=1148805&r2=1148806&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Wed Jul 20 14:55:50 2011
@@ -45,6 +45,10 @@ The <action> type attribute can be add,u
   </properties>
   <body>
     <release version="1.2" date="as in SVN" description="Release 1.2">
+      <action issue="COMPRESS-130" type="fix" date="2011-07-20">
+        The Javadoc for ZipArchiveInputStream#skip now matches the
+        implementation, the code has been made more defensive.
+      </action>
       <action issue="COMPRESS-140" type="fix" date="2011-07-20"
               due-to="Trejkaz">
         ArArchiveInputStream fails if entries contain only blanks for

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java?rev=1148806&r1=1148805&r2=1148806&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
Wed Jul 20 14:55:50 2011
@@ -313,11 +313,26 @@ public class ZipArchiveInputStream exten
         }
     }
 
+    /**
+     * Skips over and discards value bytes of data from this input
+     * stream.
+     *
+     * <p>This implementation may end up skipping over some smaller
+     * number of bytes, possibly 0, if an only if it reaches the end
+     * of the underlying stream.</p>
+     *
+     * <p>The actual number of bytes skipped is returned.</p>
+     *
+     * @param value the number of bytes to be skipped.
+     * @return the actual number of bytes skipped.
+     * @throws IOException - if an I/O error occurs.
+     * @throws IllegalArgumentException - if value is negative.
+     */
     public long skip(long value) throws IOException {
         if (value >= 0) {
             long skipped = 0;
             byte[] b = new byte[1024];
-            while (skipped != value) {
+            while (skipped < value) {
                 long rem = value - skipped;
                 int x = read(b, 0, (int) (b.length > rem ? rem : b.length));
                 if (x == -1) {



Mime
View raw message