RFR: 8225499: InetSocketAddress::toString not friendly to IPv6 literal addresses

Chris Hegarty chris.hegarty at oracle.com
Thu Oct 10 11:16:17 UTC 2019


Julia,

On 09/10/2019 12:24, Julia Boes wrote:
> Hi,
> 
> This fix improves the handling of IPv6 addresses in 
> InetSocketAddress::toString. The implementation now encloses the IPv6 
> literal in brackets, which wasn't done previously.
> 
> Example:
> 
> new InetSocketAddress("::1", 80).toString()
> before: /0:0:0:0:0:0:0:1:80
> after: /[0:0:0:0:0:0:0:1]:80
> 
> Additionally, the string format for unresolved addresses is changed to 
> 'hostname/<unresolved>:80' to closer adhere to the format of 
> 'hostname/IP literal:port'.
> 
> Example:
> 
> InetSocketAddress.createUnresolved("foo", 80).toString()
> before: foo:80
> after: foo/<unresolved>:80
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8225499
> 
> Webrev: http://cr.openjdk.java.net/~jboes/webrevs/8225499/webrev.00/
> 
> CSR: https://bugs.openjdk.java.net/browse/JDK-8232002

I think this is good.

The specification for InetSocketAddress already defines the term 
"unresolved", and putting it in the string representation removes any 
potential for ambiguity. I also agree with adding the square brackets to 
IPv6 literals.

-Chris.


More information about the net-dev mailing list