Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 72756 invoked from network); 5 Dec 2006 16:52:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Dec 2006 16:52:46 -0000 Received: (qmail 79552 invoked by uid 500); 5 Dec 2006 16:52:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 79535 invoked by uid 500); 5 Dec 2006 16:52:54 -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 79526 invoked by uid 99); 5 Dec 2006 16:52:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 08:52:54 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 08:52:44 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8FE7E7142E4 for ; Tue, 5 Dec 2006 08:52:24 -0800 (PST) Message-ID: <13209527.1165337544587.JavaMail.jira@brutus> Date: Tue, 5 Dec 2006 08:52:24 -0800 (PST) From: "Paulex Yang (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-2436) [classlib][archive] Reading from a closed Jar file is allowed In-Reply-To: <19986556.1165241541074.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/HARMONY-2436?page=all ] Paulex Yang updated HARMONY-2436: --------------------------------- Summary: [classlib][archive] Reading from a closed Jar file is allowed (was: Reading from a closed Jar file is allowed) > [classlib][archive] Reading from a closed Jar file is allowed > ------------------------------------------------------------- > > Key: HARMONY-2436 > URL: http://issues.apache.org/jira/browse/HARMONY-2436 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Anton Ivanov > Priority: Minor > Attachments: hello_world.jar > > > Reading from InputStream which was opened on some JarFile > is allowed even if this JarFile was closed . > java.util.jar.JarFile inherits close() method from java.util.zip.ZipFile and > specification of this method ensure that if JarFile is closed all InputStreams that were obtained > via getInputStream() method will be closed. But JarFile behaves in a different manner. > Code to reproduce this problem: > import java.util.jar.*; > import java.io.*; > public class TestJarFileClose{ > public static void main(String[] args) { > byte[] b = new byte[1024]; > try { > JarFile jf = new JarFile("hello_world.jar"); > InputStream is = jf.getInputStream(jf.getEntry("hello_world/HelloWorld.class")); > jf.close(); > int r = is.read(b, 0, 1024); > System.out.println("Test failed, readed from closed JAR file: "+r); > is.close(); > } catch (Exception e) { > System.out.println("Test passed: "+e); > } > } > } > Output on RI: > Test passed: java.lang.IllegalStateException: zip file closed > Output on Harmony: > Test failed, readed from closed JAR file: 427 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira