harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r376452 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/net/URL.java test/java/org/apache/harmony/tests/java/net/URLTest.java
Date Thu, 09 Feb 2006 22:12:37 GMT
Author: tellison
Date: Thu Feb  9 14:12:29 2006
New Revision: 376452

URL: http://svn.apache.org/viewcvs?rev=376452&view=rev
Log:
Fix for HARMONY-83 (java.net.URL(String, String, int port, String) throws MalformedURLException
when port is > 65535)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java?rev=376452&r1=376451&r2=376452&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
Thu Feb  9 14:12:29 2006
@@ -313,7 +313,7 @@
 			throw new MalformedURLException(e.toString());
 		}
 
-		if (port < -1 || port > 65535)
+		if (port < -1)
 			throw new MalformedURLException(com.ibm.oti.util.Msg.getString(
 					"K0325", port)); //$NON-NLS-1$
 	}
@@ -378,7 +378,7 @@
 	 */
 	public URL(String protocol, String host, int port, String file,
 			URLStreamHandler handler) throws MalformedURLException {
-		if (port < -1 || port > 65535)
+		if (port < -1)
 			throw new MalformedURLException(com.ibm.oti.util.Msg.getString(
 					"K0325", port)); //$NON-NLS-1$
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLTest.java?rev=376452&r1=376451&r2=376452&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/net/URLTest.java
Thu Feb  9 14:12:29 2006
@@ -31,9 +31,25 @@
 		URL url = new URL("http", ipv6Host, -1, "myfile");
 		assertEquals(("[" + ipv6Host + "]"), url.getHost());
 	}
-	
+
 	/**
-	 * @tests java.net.URL#URL(java.lang.String, java.lang.String, java.lang.String)
+	 * @tests java.net.URL#URL(java.lang.String, java.lang.String, int, java.lang.String)
+	 */
+	public void test_ConstructorLjava_lang_StringLjava_lang_StringILjava_lang_String()
+			throws MalformedURLException {
+		// Regression for HARMONY-83
+		new URL("http", "apache.org", 123456789, "file");
+		try {
+			new URL("http", "apache.org", -123, "file");
+			fail("Assert 0: Negative port should throw exception");
+		} catch (MalformedURLException e) {
+			// expected
+		}
+	}
+
+	/**
+	 * @tests java.net.URL#URL(java.lang.String, java.lang.String,
+	 *        java.lang.String)
 	 */
 	public void test_ConstructorLjava_lang_StringLjava_lang_StringLjava_lang_String() throws
MalformedURLException {
 		// Strange behavior in reference, the hostname contains a ':' so it gets wrapped in '[',
']'



Mime
View raw message