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 03F0B7DA2 for ; Tue, 26 Jul 2011 04:39:36 +0000 (UTC) Received: (qmail 6388 invoked by uid 500); 26 Jul 2011 04:39:35 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 6020 invoked by uid 500); 26 Jul 2011 04:39:04 -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 6012 invoked by uid 99); 26 Jul 2011 04:38:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jul 2011 04:38:59 +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; Tue, 26 Jul 2011 04:38:55 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E0F64238890D for ; Tue, 26 Jul 2011 04:38:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1150985 - /commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Date: Tue, 26 Jul 2011 04:38:35 -0000 To: commits@commons.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110726043835.E0F64238890D@eris.apache.org> Author: bodewig Date: Tue Jul 26 04:38:35 2011 New Revision: 1150985 URL: http://svn.apache.org/viewvc?rev=1150985&view=rev Log: Assume a record is using ZIP64 if and only if the ZIP64 extended information extra field is present. http://www.pkware.com/documents/casestudies/APPNOTE.TXT says: When extracting, if the zip64 extended information extra field is present for the file the compressed and uncompressed sizes will be 8 byte values. when talking about the data descriptor, making the extra field the the thing to decide upon. InfoZip's ZIP 3.0 agrees with this interpretation. I even found this in ZIP 3.0' zipfile.c: /* PKZIP does not care of the version set in a CDH: if */ /* there is a zip64 extra field assigned to a CDH PKZIP */ /* uses it, we should do so, too. */ so "version made by" is ignored in the central directory. The comment is not present when looking at the local file header, I'm not yet decided whether to ignore the version there as well. Modified: commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Modified: commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java?rev=1150985&r1=1150984&r2=1150985&view=diff ============================================================================== --- commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java (original) +++ commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java Tue Jul 26 04:38:35 2011 @@ -210,17 +210,21 @@ public class ZipArchiveInputStream exten if (!hasUTF8Flag && useUnicodeExtraFields) { ZipUtil.setNameAndCommentFromExtraFields(current, fileName, null); } + + Zip64ExtendedInformationExtraField z64 = null; + if (usesZip64) { + z64 = (Zip64ExtendedInformationExtraField) + current.getExtraField(Zip64ExtendedInformationExtraField + .HEADER_ID); + if (z64 == null) { + // "version made by" >= 4.5 for some other reason than ZIP64 + usesZip64 = false; + } + } if (!hasDataDescriptor) { if (usesZip64 && (cSize.equals(ZipLong.ZIP64_MAGIC) || size.equals(ZipLong.ZIP64_MAGIC)) ) { - Zip64ExtendedInformationExtraField z64 = - (Zip64ExtendedInformationExtraField) - current.getExtraField(Zip64ExtendedInformationExtraField - .HEADER_ID); - if (z64 == null) { - throw new ZipException("expected ZIP64 extra field"); - } current.setCompressedSize(z64.getCompressedSize() .getLongValue()); current.setSize(z64.getSize().getLongValue());