commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1482155 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
Date Tue, 14 May 2013 00:13:15 GMT
Author: sebb
Date: Tue May 14 00:13:15 2013
New Revision: 1482155

URL: http://svn.apache.org/r1482155
Log:
Protect against NPE; throw more specific exception

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java?rev=1482155&r1=1482154&r2=1482155&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java
Tue May 14 00:13:15 2013
@@ -609,11 +609,17 @@ public class SevenZFile {
                 }
                 case NID.kEmptyFile: {
                     debug("  kEmptyFile");
+                    if (isEmptyStream == null) { // protect against NPE
+                        throw new IOException("Header format error: kEmptyStream must appear
before kEmptyFile");
+                    }
                     isEmptyFile = readBits(header, isEmptyStream.cardinality());
                     break;
                 }
                 case NID.kAnti: {
                     debug("  kAnti");
+                    if (isEmptyStream == null) { // protect against NPE
+                        throw new IOException("Header format error: kEmptyStream must appear
before kAnti");
+                    }
                     isAnti = readBits(header, isEmptyStream.cardinality());
                     break;
                 }



Mime
View raw message