JDK-6587184 : Underline Problem in java.net.URI VM 1.6.0_01
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.rmi
  • Affected Version: 6
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_2003
  • CPU: x86
  • Submitted: 2007-07-31
  • Updated: 2018-02-06
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
1.6.0_02-b05

ADDITIONAL OS VERSION INFORMATION :
reproduced with different windows systems

A DESCRIPTION OF THE PROBLEM :
Connecting Problems if char '_' in hostname


ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.net.MalformedURLException: invalid authority: //akr_sharepoint:8000/ssssss
	at java.rmi.Naming.intParseURL(Unknown Source)
	at java.rmi.Naming.parseURL(Unknown Source)
	at java.rmi.Naming.lookup("//abc_sharepoint:8000/ssssss")

It's easy to reproduce "java.net.URI.getHost()" should be the Problem.


---------- BEGIN SOURCE ----------
import java.rmi.Naming;

public class Test {
	
	public Test(){
		callLookup("host_name");
		callLookup("hostname");
	}
	
	private void callLookup(String hostName){
		System.out.println(hostName + " leads to");		
		try{
			Naming.lookup("//" + hostName + ":6666/xxxxx");
		}catch(Throwable er){
			er.printStackTrace();
		}
	}

	static public void main(String args[]) {
 		new Test();
	}
}

---------- END SOURCE ----------

REPRODUCIBILITY :
This bug can be reproduced always.

Release Regression From : 5.0
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
WORK AROUND See workaround for 5083594.
31-07-2007

EVALUATION It is true that with 5.0 (and 1.4.x) the Naming.lookup in the submitted test case does not throw a MalformedURLException for the case of a host name with an underscore, but it doesn't work correctly either: instead, the specified host name and port are ignored, instead communicating with the local host and port 1099-- that was bug 5083594. Throwing a MalformedURLException is certainly better than that behavior-- therefore, I wouldn't characterize this CR as a regression since 5.0; if anything, it is a regression since 1.3.x. We had hoped that updates to java.net.URI in JDK 6 to support RFC 3986 (which obsoletes RFCs 2396 & 2732) would resolve the problem of host names with underscores, because RFC 3986 rearranges the grammar for the "authority" component and allows a much broader set of characters for the "host" (including allowing percent-encoded characters). Unfortunately, the RFC 3986 support for java.net.URI was ultimately backed out of JDK 6 due to compatibility concerns (see 6394131).
31-07-2007