You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2006/12/28 22:00:25 UTC

[jira] Updated: (HARMONY-1700) [classlib][archive] URL.openStream() should throw FileNotFoundEx if file not exists in jar file.

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

Alexei Zakharov updated HARMONY-1700:
-------------------------------------

    Summary: [classlib][archive] URL.openStream() should throw FileNotFoundEx if file not exists in jar file.  (was: [classlib][luni] URL.openStream() should throw FileNotFoundEx if file not exists in jar file.)

Changing the prefix since the problem is in ZipFile indeed.

> [classlib][archive] URL.openStream() should throw FileNotFoundEx if file not exists in jar file.
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-1700
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1700
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: ALL
>            Reporter: Nikolay Chugunov
>            Priority: Minor
>
> URL.openStream() should throw FileNotFoundException if file not exists in jar file.
> Code for reproducing:
> package test;
> import java.io.FileNotFoundException;
> import java.net.URL;
> import junit.framework.TestCase;
> public class Bug extends TestCase {
>     public void test() throws Exception {
>         try {
>             URL url = new URL("jar:file:/C:/alternate.jar!/foo.jar!/bar");
>             url.openStream();
>         } catch (FileNotFoundException e) {
>             e.printStackTrace();
>             System.out.println("PASSED");
>         }
>     }
> }
> alternate.jar is in attachment.
> Output on RI:
> java.io.FileNotFoundException: JAR entry foo.jar!/bar not found in C:\alternate.jar
>         at
> sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:114)
>         at
> sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:124)
>         at java.net.URL.openStream(URL.java:1007)
>         at test.Bug.test(Bug.java:14)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
> PASSED
> Output on latest Harmony build r450941:
> java.util.zip.ZipException: Unable to open: C:\alternate.jar!\foo.jar
>         at java.util.zip.ZipFile.openZip(ZipFile.java:117)
>         at java.util.zip.ZipFile.<init>(ZipFile.java:90)
>         at java.util.jar.JarFile.<init>(JarFile.java:173)
>         at
> org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.openJarFile(JarURLConnection.java:237)
>         at
> org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.findJarFile(JarURLConnection.java:175)
>         at
> org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:142)
>         at
> org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:297)
>         at java.net.URL.openStream(URL.java:645)
>         at test.Bug.test(Bug.java:12)

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