JDK-8223214 : Inet6AddressImpl.loopbackAddress() should choose loopback address that is available
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-05-01
  • Updated: 2019-05-28
  • Resolved: 2019-05-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b22Fixed
Description
Currently, Inet6AddressImpl.loopbackAddress() will unconditionally choose the IPv6 loopback address if java.net.preferIPv6Address is set to "system" or "true", else unconditionally choose the IPv4 loopback address.

Instead it should try out both loopback addresses and return whichever one works, giving preference to IPv6 if java.net.preferIPv6Address is set to "system" or "true", else giving preference to IPv4. This way there is no need to set java.net.preferIPv6Address in an IPv6-only environment to get a valid loopback address.