Name: rmT116609 Date: 10/03/2002
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION :
glibc-2.2.5-16mdk
Linux jakarta.cpd.ufsm.br 2.4.19-16mdk-leonardo #2 Wed Oct 2
13:58:10 BRT 2002 i686 unknown unknown GNU/Linux
Mandrake Linux release 9.0 (dolphin) for i586
Windows 2000
A DESCRIPTION OF THE PROBLEM :
If a java.net.URI is constructed with an URI whose host name
starts with a digit and is not a valid IP address,
java.net.URI.getHost() == null.
This bug is critical in my organization, where the host
names start with the room number. We're deploying RMI
services, and the clients (applets) can't connect with the
registry service because java.rmi.Naming uses java.net.URI
internally. When java.net.URI.getHost() returns null,
java.rmi.Naming tries to connect with a registry in the
local host, producing an AccessControlException (and a
ConnectException).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Construct a new java.net.URI with a string representing a
URI in the form :
[scheme]://[one_or_more_digits][remaining_host_name]/[anything]
(for example: rmi://126g/MyServer)
2. java.net.URI.getHost() returns null
(it should return "126g" in that case)
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected Result:
java.net.URI.getHost() returns the host name
Actual Result:
java.net.URI.getHost() returns null
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No exceptions.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.URI;
public class Test
{
public static void main(String[] args)
throws Exception
{
String uri = "rmi://126g/MyServer";
System.out.println("uri = " + uri);
System.out.println("getHost() = " + new URI(uri).getHost());
}
}
---------- END SOURCE ----------
(Review ID: 165342)
======================================================================