Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1FEBCDBC1 for ; Fri, 16 Nov 2012 14:26:14 +0000 (UTC) Received: (qmail 57998 invoked by uid 500); 16 Nov 2012 14:26:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 57642 invoked by uid 500); 16 Nov 2012 14:26:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 57610 invoked by uid 99); 16 Nov 2012 14:26:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Nov 2012 14:26:12 +0000 Date: Fri, 16 Nov 2012 14:26:12 +0000 (UTC) From: "Dmitry Katsubo (JIRA)" To: issues@commons.apache.org Message-ID: <592477641.123931.1353075972242.JavaMail.jiratomcat@arcas> In-Reply-To: <1118992892.58504.1340746244600.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Commented] (COMPRESS-189) ZipArchiveInputStream may read 0 bytes when reading from a nested Zip file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13498834#comment-13498834 ] Dmitry Katsubo commented on COMPRESS-189: ----------------------------------------- I confirm the problem. I agree that {{java.util.zip.Inflater}} is not used according to JavaDocs and that causes the problem in some cases. > ZipArchiveInputStream may read 0 bytes when reading from a nested Zip file > -------------------------------------------------------------------------- > > Key: COMPRESS-189 > URL: https://issues.apache.org/jira/browse/COMPRESS-189 > Project: Commons Compress > Issue Type: Bug > Components: Archivers > Affects Versions: 1.4.1 > Environment: JDK 1.6 64-bit, Windows 7 > Reporter: Daniel Lowe > Priority: Blocker > > When the following code is run an error "Underlying input stream returned zero bytes" is produced. If the commented line is uncommented it can be seen that the ZipArchiveInputStream returned 0 bytes. This only happens the first time read is called, subsequent calls work as expected i.e. the following code actually works correctly with that line uncommented! > The zip file used to produce this behavious is available at http://wwmm.ch.cam.ac.uk/~dl387/test.ZIP > If this is not the correct way of processing a zip file of zip files please let me know. Also I believe whilst ZipFile can iterate over entries fast due to being able to look at the master table whilst ZipArchiveInputStream cannot. Is there anyway of instantiating a ZipFile from a zip file inside another zip file without first extracting the nested zip file? > ZipFile zipFile = new ZipFile("C:/test.ZIP"); > for (Enumeration iterator = zipFile.getEntries(); iterator.hasMoreElements(); ) { > ZipArchiveEntry entry = iterator.nextElement(); > InputStream is = new BufferedInputStream(zipFile.getInputStream(entry)); > ZipArchiveInputStream zipInput = new ZipArchiveInputStream(is); > ZipArchiveEntry innerEntry; > while ((innerEntry = zipInput.getNextZipEntry()) != null){ > if (innerEntry.getName().endsWith("XML")){ > //zipInput.read(); > System.out.println(IOUtils.toString(zipInput)); > } > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira