commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1222360 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Date Thu, 22 Dec 2011 17:22:19 GMT
Author: bodewig
Date: Thu Dec 22 17:22:19 2011
New Revision: 1222360

URL: http://svn.apache.org/viewvc?rev=1222360&view=rev
Log:
throw an IOException rather than a RuntimeException for a certain type of corrupted ZIPs.
 COMPRESS-169

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.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=1222360&r1=1222359&r2=1222360&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Thu Dec 22 17:22:19 2011
@@ -75,6 +75,11 @@ The <action> type attribute can be add,u
         The tar package can now use the POSIX/PAX variant for writing
         entries with names longer than 100 characters.
       </action>
+      <action issue="COMPRESS-169" type="fix" date="2011-12-22">
+        For corrupt archives ZipFile would throw a RuntimeException in
+        some cases and an IOException in others.  It will now
+        consistently throw an IOException.
+      </action>
     </release>
     <release version="1.3" date="2011-11-01"
              description="Release 1.3 - API compatible to 1.2 but requires Java5 at runtime">

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java?rev=1222360&r1=1222359&r2=1222360&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java
Thu Dec 22 17:22:19 2011
@@ -821,8 +821,8 @@ public class ZipFile {
             while (lenToSkip > 0) {
                 int skipped = archive.skipBytes(lenToSkip);
                 if (skipped <= 0) {
-                    throw new RuntimeException("failed to skip file name in"
-                                               + " local file header");
+                    throw new IOException("failed to skip file name in"
+                                          + " local file header");
                 }
                 lenToSkip -= skipped;
             }



Mime
View raw message