harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r501100 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/JarURLConnection.java test/java/tests/api/java/net/JarURLConnectionTest.java
Date Mon, 29 Jan 2007 16:42:25 GMT
Author: tellison
Date: Mon Jan 29 08:42:23 2007
New Revision: 501100

URL: http://svn.apache.org/viewvc?view=rev&rev=501100
Log:
Apply patch HARMONY-3053 ([classlib][luni]JarURLConnection.getEntryName() returns incorrect
value)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/JarURLConnection.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/JarURLConnection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/JarURLConnection.java?view=diff&rev=501100&r1=501099&r2=501100
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/JarURLConnection.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/JarURLConnection.java
Mon Jan 29 08:42:23 2007
@@ -51,8 +51,7 @@
         super(url);
         file = url.getFile();
         int sepIdx;
-        // Support embedded jar URLs by using lastIndexOf()
-        if ((sepIdx = file.lastIndexOf("!/")) < 0) { //$NON-NLS-1$
+        if ((sepIdx = file.indexOf("!/")) < 0) { //$NON-NLS-1$
             throw new MalformedURLException();
         }
         if (file.length() == sepIdx + 2) {
@@ -154,9 +153,8 @@
             return fileURL;
         }
         try {
-            // Support embedded jar URLs by using lastIndexOf()
             return fileURL = new URL(url.getFile().substring(0,
-                    url.getFile().lastIndexOf("!/"))); //$NON-NLS-1$
+                    url.getFile().indexOf("!/"))); //$NON-NLS-1$
         } catch (MalformedURLException e) {
             return null;
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java?view=diff&rev=501100&r1=501099&r2=501100
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/JarURLConnectionTest.java
Mon Jan 29 08:42:23 2007
@@ -66,6 +66,9 @@
         u = new URL("jar:" + BASE.toString()+"/lf.jar!/");
         juc = (JarURLConnection) u.openConnection();
         assertNull("Returned incorrect entryName", juc.getEntryName());
+//      Regression test for harmony-3053
+        URL url = new URL("jar:file:///bar.jar!/foo.jar!/Bugs/HelloWorld.class");
+		assertEquals("foo.jar!/Bugs/HelloWorld.class",((JarURLConnection)url.openConnection()).getEntryName());
     }
 
 	/**
@@ -156,6 +159,9 @@
         juc = (JarURLConnection) u.openConnection();
         assertTrue("Returned incorrect file URL", juc.getJarFileURL().equals(
                 fileURL));
+        // Regression test for harmony-3053
+        URL url = new URL("jar:file:///bar.jar!/foo.jar!/Bugs/HelloWorld.class");
+        assertEquals("file:/bar.jar",((JarURLConnection)url.openConnection()).getJarFileURL().toString());
     }
 
 	/**



Mime
View raw message