Name: nt126004 Date: 07/15/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Linux 7.3
ADDITIONAL OPERATING SYSTEMS :
Windows 2000
A DESCRIPTION OF THE PROBLEM :
The code included below throws a NumberFormatException for
a "valid" URI. I put valid in quotes because the domain
name in the URI doesn't follow the recommendations of RFC
1034. Nevertheless, the domain does exist - but you can't
get there through Java.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the included source code.
2. Execute the class.
3. Observe the goofy exception.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: the uri should be printed.
Actual: exception.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NumberFormatException: 8007456830
at java.lang.Integer.parseInt(Integer.java:438)
at java.lang.Integer.parseInt(Integer.java:476)
at java.net.URI$Parser.scanByte(URI.java:3099)
at java.net.URI$Parser.scanIPv4Address(URI.java:3129)
at java.net.URI$Parser.parseIPv4Address(URI.java:3162)
at java.net.URI$Parser.parseServer(URI.java:3065)
at java.net.URI$Parser.parseAuthority(URI.java:2998)
at java.net.URI$Parser.parseHierarchical(URI.java:2948)
at java.net.URI$Parser.parse(URI.java:2904)
at java.net.URI.<init>(URI.java:565)
at Test.main(Test.java:8)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.*;
public class Test
{
public static void main(String[] args)
{
try {
URI u = new URI("http://8007456830.com");
System.out.println("URI = '" + u + "'");
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
(Review ID: 159374)
======================================================================