harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r964691 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src: main/java/java/net/URLStreamHandler.java test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
Date Fri, 16 Jul 2010 06:23:06 GMT
Author: regisxu
Date: Fri Jul 16 06:23:06 2010
New Revision: 964691

URL: http://svn.apache.org/viewvc?rev=964691&view=rev
Log:
Apply patch for HARMONY-6573: [classlib][luni] Can't load classes with file://// and URL class

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java?rev=964691&r1=964690&r2=964691&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/net/URLStreamHandler.java
Fri Jul 16 06:23:06 2010
@@ -111,7 +111,7 @@ public abstract class URLStreamHandler {
         String userInfo = u.getUserInfo();
 
         int refIdx = parseString.indexOf('#', 0);
-        if (parseString.startsWith("//")) { //$NON-NLS-1$
+        if (parseString.startsWith("//") && !parseString.startsWith("////")) { //$NON-NLS-1$
             int hostIdx = 2, portIdx = -1;
             port = -1;
             fileIdx = parseString.indexOf('/', hostIdx);

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java?rev=964691&r1=964690&r2=964691&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URLTest.java
Fri Jul 16 06:23:06 2010
@@ -249,6 +249,19 @@ public class URLTest extends TestCase {
         assertTrue("u10 returns a wrong port " + u10.getPort(),
                 u10.getPort() == -1);
 
+		URL u11 = new URL("file:////file.txt");
+        assertNull("u11 returns a wrong authority " + u11.getAuthority(), u11
+                .getAuthority());
+        assertTrue("u11 returns a wrong file " + u11.getFile(), u11.getFile()
+                .equals("////file.txt"));
+
+        URL u12 = new URL("file:///file.txt");
+        assertTrue("u12 returns a wrong authority", u12.getAuthority().equals(
+                ""));
+        assertTrue("u12 returns a wrong file " + u12.getFile(), u12.getFile()
+                .equals("/file.txt"));
+
+
         // test for error catching
 
         // Bad HTTP format - no "//"



Mime
View raw message