Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 70956 invoked from network); 9 Dec 2009 02:52:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Dec 2009 02:52:41 -0000 Received: (qmail 60348 invoked by uid 500); 9 Dec 2009 02:52:41 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 60261 invoked by uid 500); 9 Dec 2009 02:52:41 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 60251 invoked by uid 99); 9 Dec 2009 02:52:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Dec 2009 02:52:40 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Dec 2009 02:52:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 32E12234C04C for ; Tue, 8 Dec 2009 18:52:18 -0800 (PST) Message-ID: <1765428912.1260327138194.JavaMail.jira@brutus> Date: Wed, 9 Dec 2009 02:52:18 +0000 (UTC) From: "Ray Chen (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-6253) [classlib][archive] java.util.jar.JarInputStream.getNextJarEntry() should not throw ZipException In-Reply-To: <1076651033.1246282427372.JavaMail.jira@brutus> 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/HARMONY-6253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ray Chen updated HARMONY-6253: ------------------------------ Attachment: 6253.diff Hi, I have investigated this issue, the exception is throwed at line 191 of ZipInputStream.java because currentEntry.compressedSize and inB are not equal, and currentEntry.compressedSize is set at line 140 of ZipOutputStream.java It assumed that the output byte size should be equal to input byte size, but is this supposition right? Even for RI, the size of ant.jar and ant.jar.gz are not equal. RI: ant.jar.gz < ant.jar (958,439 bytes and 958,858 bytes ) Harmony: ant.jar.gz > ant.jar (966,972 bytes and 958,858 bytes) So, in the patch I simply remove the comparison between currentEntry.compressedSize and inB, and didn't see any regression. Any comments? > [classlib][archive] java.util.jar.JarInputStream.getNextJarEntry() should not throw ZipException > ------------------------------------------------------------------------------------------------ > > Key: HARMONY-6253 > URL: https://issues.apache.org/jira/browse/HARMONY-6253 > Project: Harmony > Issue Type: Bug > Components: Classlib > Affects Versions: 5.0M10 > Reporter: Kevin Zhou > Attachments: 6253.diff, ant.jar > > Original Estimate: 48h > Remaining Estimate: 48h > > Given a test case [1], RI passes it smoothly while HARMONY throws a java.util.zip.ZipException [2]. > [1] Test Case: > public void testJarInputStream() throws Exception { > JarInputStream jarInputStream = new JarInputStream(new FileInputStream("lib/ant.jar")); > JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream("lib/ant.jar.gz")); > JarEntry jarEntry; > byte[] bytes = new byte[1024]; > InputStream inputStream = new BufferedInputStream(jarInputStream); > while ((jarEntry = jarInputStream.getNextJarEntry()) != null) { > jarOutputStream.putNextEntry(jarEntry); > int read = -1; > while ((read = inputStream.read(bytes)) != -1) { > jarOutputStream.write(bytes, 0, read); > } > jarOutputStream.closeEntry(); > } > jarOutputStream.close(); > } > [2] Stack Trace: > java.util.zip.ZipException: Size mismatch > at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:138) > at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:156) > at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:160) > at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:111) > at Test.testJarInputStream(Test.java:22) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.