Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 858E5113D6 for ; Sun, 13 Apr 2014 08:38:56 +0000 (UTC) Received: (qmail 88410 invoked by uid 500); 13 Apr 2014 08:38:55 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 88332 invoked by uid 500); 13 Apr 2014 08:38:54 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 88325 invoked by uid 99); 13 Apr 2014 08:38:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Apr 2014 08:38:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Apr 2014 08:38:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 497FC238889B; Sun, 13 Apr 2014 08:38:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1586937 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/arj/ArjArchiveEntry.java main/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStream.java Date: Sun, 13 Apr 2014 08:38:32 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140413083832.497FC238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 type attribute can be add,u ArchiveStreams now validate there is a current entry before rreading or writing entry data. + + ArjArchiveInputStream#canReadEntryData tested the current + entry of the stream rather than its argument. + 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) {