A DESCRIPTION OF THE REQUEST :
Hi,
I am reporting a bug or an enhancement referring to the bug id [8132508](http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8132508).
Referring the comments:
```
RFC 952 disallows _ underscores in hostnames. So, this is not a bug. I also haven't been able to find examples of actual usage.
So, unless a particularly compelling case can be made, I'm closing as not a bug.
```
However, if hostname contains underscores is not a valid hostname, why it is in java.net.URL? More clearly, valid in java.net.URL INvalid in java.net.URI. These issue often confused developers and cannot get the consistent on lot of third-part jars.
The following statements demonstrate this issue:
new java.net.URI("http://test_1.tanglei.name").getHost() // = null
new java.net.URL("http://test_1.tanglei.name").getHost() // "test_1.tanglei.name"
Wish your reply.
JUSTIFICATION :
The following statements demonstrate this issue:
new java.net.URI("http://test_1.tanglei.name").getHost() // = null
new java.net.URL("http://test_1.tanglei.name").getHost() // "test_1.tanglei.name"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If the underscore is not valid in hostname, both URL and URI getHost should return null.
ACTUAL -
new java.net.URI("http://test_1.tanglei.name").getHost() return null
new java.net.URL("http://test_1.tanglei.name").getHost() return "test_1.tanglei.name"
Hi,
I am reporting a bug or an enhancement referring to the bug id [8132508](http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8132508).
Referring the comments:
```
RFC 952 disallows _ underscores in hostnames. So, this is not a bug. I also haven't been able to find examples of actual usage.
So, unless a particularly compelling case can be made, I'm closing as not a bug.
```
However, if hostname contains underscores is not a valid hostname, why it is in java.net.URL? More clearly, valid in java.net.URL INvalid in java.net.URI. These issue often confused developers and cannot get the consistent on lot of third-part jars.
The following statements demonstrate this issue:
new java.net.URI("http://test_1.tanglei.name").getHost() // = null
new java.net.URL("http://test_1.tanglei.name").getHost() // "test_1.tanglei.name"
Wish your reply.
JUSTIFICATION :
The following statements demonstrate this issue:
new java.net.URI("http://test_1.tanglei.name").getHost() // = null
new java.net.URL("http://test_1.tanglei.name").getHost() // "test_1.tanglei.name"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If the underscore is not valid in hostname, both URL and URI getHost should return null.
ACTUAL -
new java.net.URI("http://test_1.tanglei.name").getHost() return null
new java.net.URL("http://test_1.tanglei.name").getHost() return "test_1.tanglei.name"
- duplicates
-
JDK-8187131 java.net.URI throws URISyntaxException when hostname contains underscore.
-
- Closed
-
- relates to
-
JDK-8072064 toLowerCase() in java.net.HostPortrange fails on underscore character
-
- Open
-