Author: bodewig
Date: Sun Apr 13 08:38:31 2014
New Revision: 1586937

URL: http://svn.apache.org/r1586937
Log:
ArjArchiveInputStream#canReadEntryData wasn't checking the entry it was 
supposed to check

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
    
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.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=1586937&r1=1586936&r2=1586937&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sun Apr 13 08:38:31 
2014
@@ -63,6 +63,10 @@ The <action> type attribute can be add,u
         ArchiveStreams now validate there is a current entry before
         rreading or writing entry data.
       </action>
+      <action type="fix" date="2014-04-13">
+        ArjArchiveInputStream#canReadEntryData tested the current
+        entry of the stream rather than its argument.
+      </action>
     </release>
     <release version="1.8" date="2014-03-12"
              description="Release 1.8">

Modified: 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
URL: 
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java?rev=1586937&r1=1586936&r2=1586937&view=diff
==============================================================================
--- 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
 (original)
+++ 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java
 Sun Apr 13 08:38:31 2014
@@ -122,6 +122,10 @@ public class ArjArchiveEntry implements 
         return getHostOs() == HostOs.UNIX || getHostOs() == HostOs.NEXT;
     }
 
+    int getMethod() {
+        return localFileHeader.method;
+    }
+
     /**
      * The known values for HostOs.
      */

Modified: 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
URL: 
http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java?rev=1586937&r1=1586936&r2=1586937&view=diff
==============================================================================
--- 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
 (original)
+++ 
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java
 Sun Apr 13 08:38:31 2014
@@ -333,12 +333,13 @@ public class ArjArchiveInputStream exten
             return null;
         }
     }
-    
+
     @Override
     public boolean canReadEntryData(ArchiveEntry ae) {
-        return currentLocalFileHeader.method == LocalFileHeader.Methods.STORED;
+        return ae instanceof ArjArchiveEntry
+            && ((ArjArchiveEntry) ae).getMethod() == 
LocalFileHeader.Methods.STORED;
     }
-    
+
     @Override
     public int read(final byte[] b, final int off, final int len) throws 
IOException {
         if (currentLocalFileHeader == null) {


Reply via email to