SocketAddress.toString() and RFC 2732
Alan.Bateman at oracle.com
Sat Jun 8 06:38:51 UTC 2019
On 07/06/2019 19:46, Chris wrote:
> java.net.SocketAddress can represent an IPv6 address with port.
> Because parts of an IPv6 address are separated with colons and a colon
> is also used to separate the address from the port, RFC 2732 specifies
> that the address be in square brackets in this case, e.g.
> "[::1]:8080". Shouldn't that be the behavior of
> SocketAddress.toString()? Instead, it omits the square brackets.
Moving this to net-dev as that this where this API is maintained.
Yes, this seems an oversight as it is always problematic to read/parse a
String that is an IPv6 literal address followed by :<port>. I suspect
this will require a small spec change to InetSocketAddress::toString.
You mail is timely as there is a lot of activity going on at this time
on net-dev to allow the JDK work in IPv6-only environments. I'll create
an issue in JBS for this.
More information about the net-dev