You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Igor V. Stolyarov (JIRA)" <ji...@apache.org> on 2006/08/22 10:31:14 UTC

[jira] Updated: (HARMONY-1254) [classlib][luni] org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection caches jar resource always

     [ http://issues.apache.org/jira/browse/HARMONY-1254?page=all ]

Igor V. Stolyarov updated HARMONY-1254:
---------------------------------------

    Attachment: Harmony-1254.patch

Fix attached

Output when patch was applied:
java version 1.5 (subset)
 
(c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
META-INF/
META-INF/MANIFEST.MF
Hello.class
Hello.class


> [classlib][luni] org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection caches jar resource always
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1254
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1254
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Igor V. Stolyarov
>         Attachments: Harmony-1254.patch
>
>
> org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection doesn't respond on setUseCaches(false) and caches jar resource always
> Test--------------------------------------------------------------------------
> public class Hello{
>     public static void main(String argv[]){
>         System.out.println("Hello world!");
>     }
> }
> 1. Compile Hello.java
> 2. Create hello.jar and put Hello.class into hello.jar
> import java.io.IOException;
> import java.net.JarURLConnection;
> import java.net.MalformedURLException;
> import java.net.URL;
> import java.util.Enumeration;
> import java.util.jar.JarEntry;
> import java.util.jar.JarFile;
> public class JarURLConnectionTest {
>     
>     public static void main(String argv[]){
>         try {
>             URL jarUrl = new URL("jar", "", "file:hello.jar!/META-INF/");
>             JarURLConnection juc = (JarURLConnection)jarUrl.openConnection();
>             juc.setUseCaches(false);
>             JarFile jf = juc.getJarFile();
>             for(Enumeration e = jf.entries();e.hasMoreElements();){
>                 JarEntry entry = (JarEntry)e.nextElement();
>                 System.out.println(entry.getName());
>             }
>             jf.close();
>             juc = (JarURLConnection)jarUrl.openConnection();
>             jf = juc.getJarFile();
>             System.out.println(jf.getEntry("Hello.class"));
>         } catch (MalformedURLException e) {
>             e.printStackTrace();
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
>     }
> }
> RunrURLConnectionTest
> Outpup--------------------------------------------------------------------------------------------------
> JRockit:
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))
> META-INF/
> META-INF/MANIFEST.MF
> Hello.class
> Hello.class
> Harmony:
> java version 1.5 (subset)
>  
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> META-INF/
> META-INF/MANIFEST.MF
> Hello.class
> Exception in thread "main" java.lang.IllegalStateException: 
>         at java.util.zip.ZipFile.getEntryImpl(Native Method)
>         at java.util.zip.ZipFile.getEntry(ZipFile.java:166)
>         at java.util.jar.JarFile.getEntry(JarFile.java:368)
>         at java.util.jar.JarFile.getJarEntry(JarFile.java:245)
>         at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.findJarEntry(JarURLConnection.java:274)
>         at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:144)
>         at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:159)
>         at JarURLConnectionTest.main(JarURLConnectionTest.java:36)

-- 
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