Regarding 8220575: Correctly format test URI's that contain a retrieved IPv6 address

Chris Hegarty chris.hegarty at oracle.com
Wed Mar 13 17:32:27 UTC 2019


I filed the 8220575 [1] that tracks "Correctly format test URI's that
contain a retrieved IPv6 address"

Regarding fixing tests that incorrectly use IPv6 addresses in URL's or
URI's, without enclosing the address within '[' and ']' ( square
brackets ). These IPv6 addresses typically come from either of: 1)
the InetAddress.getLoopbackAddress().getHostAddress(), or 2)
InetAddress.getLocalHost().getHostAddress(). I think that is most cases
it should be possible to just replace the use of `getHostAddress` with
`getHostName`. This defers the actual lookup to the system configured
name service ( rather than trying to encode IPv6 addresses in the
test ).

Also, URL's / URI's that hardcode "127.0.0.1", can ( in most cases )
just be replaced with InetAddress.getLoopbackAddress().getHostName().

I've followed the above advise on a few tests and it seems to be working
out ok, so far.

-Chris.

[1] https://bugs.openjdk.java.net/browse/JDK-8220575


More information about the net-dev mailing list