harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Strigun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-29) java.util.zip.ZipException while onening jar file on local machine
Date Fri, 13 Jan 2006 15:53:21 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-29?page=comments#action_12362663 ] 

Vladimir Strigun commented on HARMONY-29:
-----------------------------------------

The cause of problem is creation of file with undecoded file path inside openJarFile method.
The fix is very simple and so can be like this (diffs to revision 367369 of /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/com/ibm/oti/net/www/protocol/jar/JarURLConnection.java)
 :

25a26,27
> import java.net.URI;
> import java.net.URISyntaxException;
235c237,241
<                       jar = new JarFile(new File(fileString), true, flags);
---
>                       try {
>                           jar = new JarFile(new File(new URI(fileString).getPath()),
true, flags);
>                       } catch (URISyntaxException use) {
>                           throw new FileNotFoundException();
>                       }

> java.util.zip.ZipException while onening jar file on local machine
> ------------------------------------------------------------------
>
>          Key: HARMONY-29
>          URL: http://issues.apache.org/jira/browse/HARMONY-29
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Geir Magnusson Jr

>
> When I try to get entries from jar file I get java.util.zip.ZipException. Here is testcase
for reproducing the issue:
> import java.net.JarURLConnection;
> import java.net.URL;
> import java.util.Enumeration;
> public class TestZipFile {
>     public static void main(String argv[]) throws Throwable {
>         final String urlStr = "jar:file:/C:/Documents%20and%20Settings/" +
>                 "user/test.jar!/Test.class";
>         JarURLConnection conn = (JarURLConnection)
>                 new URL(urlStr).openConnection();
>         Enumeration enum = conn.getJarFile().entries();
>         System.out.println("PASS");
>     }
> }
> On RI test passed, but with Harmony classlibs I get following exception:
> java.util.zip.ZipException: Unable to open: C:\Documents%20and%20Settings\user\test.jar
>         at java.util.zip.ZipFile.openZip()
>         at java.util.zip.ZipFile.<init>()
>         at java.util.jar.JarFile.<init>()
>         at com.ibm.oti.net.www.protocol.jar.JarURLConnection.openJarFile()
>         at com.ibm.oti.net.www.protocol.jar.JarURLConnection.findJarFile()
>         at com.ibm.oti.net.www.protocol.jar.JarURLConnection.connect()
>         at com.ibm.oti.net.www.protocol.jar.JarURLConnection.getJarFile()
>         at TestZipFile.main(TestZipFile.java:9)

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


Mime
View raw message