You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Svetlana Samoilenko (JIRA)" <ji...@apache.org> on 2006/02/08 11:14:59 UTC
[jira] Created: (HARMONY-83) java.net.URL(String, String, int port,
String) throws MalformedURLException when protocol is known
java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known
--------------------------------------------------------------------------------------------------
Key: HARMONY-83
URL: http://issues.apache.org/jira/browse/HARMONY-83
Project: Harmony
Type: Bug
Components: Classlib
Reporter: Svetlana Samoilenko
Priority: Minor
According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
MalformedURLException - if an unknown protocol is specified.
Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
Code to reproduce:
import java.net.*;
public class test2 {
public static void main(String[] args) {
try {
new URL("http", "google.com", 1093812784, "file" );
System.out.println("Test passed");
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
Steps to Reproduce:
1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
2. Compile test2.java using BEA 1.4 javac
> javac -d . test2.java
3. Run java using compatible VM (J9)
> java -showversion test2
Output:
C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
Test passed
C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
java.net.MalformedURLException: Port out of range: 1093812784
at java.net.URL.<init>(URL.java:382)
at java.net.URL.<init>(URL.java:356)
at test2.main(test2.java:6)
Suggested fix in attachment.
Suggested junit test case:
------------------------ URLTest.java -------------------------------------------------
import java.net.*;
import junit.framework.*;
public class URLTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(URLTest.class);
}
public void test_constructor () {
try {
new URL("http", "google.com", 1093812784, "file" );
} catch (MalformedURLException e) {
fail("unexpected MalformedURLException");
}
}
}
--
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
[jira] Resolved: (HARMONY-83) java.net.URL(String, String, int
port, String) throws MalformedURLException when port is > 65535
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=all ]
Tim Ellison resolved HARMONY-83:
--------------------------------
Resolution: Fixed
Svetlana,
Your proposed fix is incorrect because tests show that 1.4 and 1.5 do throw the exception for ports < -1.
Fixed in LUNI java.net.URL at repo revision 376452.
Please check that this fully resolves your problem.
> java.net.URL(String, String, int port, String) throws MalformedURLException when port is > 65535
> ------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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
[jira] Commented: (HARMONY-83) java.net.URL(String, String, int
port, String) throws MalformedURLException when port is > 65535
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=comments#action_12365854 ]
Svetlana Samoilenko commented on HARMONY-83:
--------------------------------------------
Tim , thank you, I agree with your fix.
Verified on revision 376452.
> java.net.URL(String, String, int port, String) throws MalformedURLException when port is > 65535
> ------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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
[jira] Updated: (HARMONY-83) java.net.URL(String, String, int port,
String) throws MalformedURLException when port is > 65535
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=all ]
Tim Ellison updated HARMONY-83:
-------------------------------
Summary: java.net.URL(String, String, int port, String) throws MalformedURLException when port is > 65535 (was: java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known)
> java.net.URL(String, String, int port, String) throws MalformedURLException when port is > 65535
> ------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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
[jira] Commented: (HARMONY-83) java.net.URL(String, String, int
port, String) throws MalformedURLException when protocol is known
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=comments#action_12365543 ]
Svetlana Samoilenko commented on HARMONY-83:
--------------------------------------------
I could not attach a file. server reperted about error.
Index: C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java
===================================================================
--- C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java (revision 375577)
+++ C:/users/TCKTeam/ws/trunk/modules/luni/src/main/java/java/net/URL.java (working copy)
@@ -313,9 +313,6 @@
throw new MalformedURLException(e.toString());
}
- if (port < -1 || port > 65535)
- throw new MalformedURLException(com.ibm.oti.util.Msg.getString(
- "K0325", port)); //$NON-NLS-1$
}
/**
@@ -378,10 +375,7 @@
*/
public URL(String protocol, String host, int port, String file,
URLStreamHandler handler) throws MalformedURLException {
- if (port < -1 || port > 65535)
- throw new MalformedURLException(com.ibm.oti.util.Msg.getString(
- "K0325", port)); //$NON-NLS-1$
-
+
if (host != null && host.indexOf(":") != -1 && host.charAt(0) != '[') {
host = "[" + host + "]";
}
> java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known
> --------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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
[jira] Closed: (HARMONY-83) java.net.URL(String, String, int port,
String) throws MalformedURLException when port is > 65535
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=all ]
Tim Ellison closed HARMONY-83:
------------------------------
Verified by Svetlana
> java.net.URL(String, String, int port, String) throws MalformedURLException when port is > 65535
> ------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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
[jira] Assigned: (HARMONY-83) java.net.URL(String, String, int
port, String) throws MalformedURLException when protocol is known
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-83?page=all ]
Tim Ellison reassigned HARMONY-83:
----------------------------------
Assign To: Tim Ellison
> java.net.URL(String, String, int port, String) throws MalformedURLException when protocol is known
> --------------------------------------------------------------------------------------------------
>
> Key: HARMONY-83
> URL: http://issues.apache.org/jira/browse/HARMONY-83
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Tim Ellison
> Priority: Minor
>
> According to the j2se 1.4 and 1.5 specification constructor java.net.URL(String, String, int port, String) throws
> MalformedURLException - if an unknown protocol is specified.
> Harmony throws the exception if protocol is correct but a port out of range that contradicts specification.
> Code to reproduce:
> import java.net.*;
> public class test2 {
> public static void main(String[] args) {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> System.out.println("Test passed");
> } catch (MalformedURLException e) {
> e.printStackTrace();
> }
> }
> }
> Steps to Reproduce:
> 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt.
> 2. Compile test2.java using BEA 1.4 javac
> > javac -d . test2.java
> 3. Run java using compatible VM (J9)
> > java -showversion test2
> Output:
> C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> Test passed
> C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> java.net.MalformedURLException: Port out of range: 1093812784
> at java.net.URL.<init>(URL.java:382)
> at java.net.URL.<init>(URL.java:356)
> at test2.main(test2.java:6)
> Suggested fix in attachment.
> Suggested junit test case:
> ------------------------ URLTest.java -------------------------------------------------
> import java.net.*;
> import junit.framework.*;
> public class URLTest extends TestCase {
> public static void main(String[] args) {
> junit.textui.TestRunner.run(URLTest.class);
> }
> public void test_constructor () {
> try {
> new URL("http", "google.com", 1093812784, "file" );
> } catch (MalformedURLException e) {
> fail("unexpected MalformedURLException");
> }
> }
> }
--
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