You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2006/09/28 09:20:51 UTC

svn commit: r450729 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/URI.java test/java/tests/api/java/net/URITest.java

Author: pyang
Date: Thu Sep 28 00:20:50 2006
New Revision: 450729

URL: http://svn.apache.org/viewvc?view=rev&rev=450729
Log:
Apply patch for HARMONY-1346([classlib][net] no URISyntaxException for URI(null, :2:3:4:5:6:7:8, /, null))

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java?view=diff&rev=450729&r1=450728&r2=450729
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URI.java Thu Sep 28 00:20:50 2006
@@ -1,4 +1,4 @@
-/* Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2004, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -592,6 +592,10 @@
                     }
 					if (ipAddress.charAt(length - 1) != ']') {
                         return false; // must have a close ]
+                    }
+                    if ((ipAddress.charAt(1) == ':')
+                            && (ipAddress.charAt(2) != ':')) {
+                        return false;
                     }
 					offset = 1;
 					if (length < 4) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java?view=diff&rev=450729&r1=450728&r2=450729
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/net/URITest.java Thu Sep 28 00:20:50 2006
@@ -1,4 +1,4 @@
-/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 2002, 2006 The Apache Software Foundation or its licensors, as applicable
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -416,6 +416,14 @@
 		} catch (URISyntaxException e) {
 			fail("Unexpected URISyntaxException:" + e);
 		}
+        
+        // regression for Harmony-1346
+        try {
+            uri = new URI("http", ":2:3:4:5:6:7:8", "/apath", "\u20ACfrag");
+            fail("Should throw URISyntaxException");
+        } catch (URISyntaxException e) {
+            // Expected
+        }
 	}
 
 	/**