On Tue, 16 Dec 2025 15:18:11 GMT, Matthias Baesken <[email protected]> wrote:

> In [JDK-8373676](https://bugs.openjdk.org/browse/JDK-8373676)
> we noticed a "SocketException: Protocol family unavailable" because of 
> missing ipv6 support. We could improve this exception and tell that the ipv6 
> support is not available or something related.

src/java.base/unix/native/libnet/net_util_md.c line 285:

> 283:         jint address;
> 284:         if (family != java_net_InetAddress_IPv4) {
> 285:             JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", 
> "Protocol family ipv6, but ipv6 on machine unavailable");

Hello Matthias, just a drive-by comment. I haven't yet paid close attention to 
this proposal. If we are going to change this message, then perhaps just change 
it to `IPv6 protocol family unavailable`. 

Looking at the implementation of `ipv6_available()`, for it to return `false` 
and thus to throw this exception, either IPv6 isn't supported on that host or 
the `-Djava.net.preferIPv4Stack=true` system property is set. So I think it's 
better to leave out the IPv6 not available on machine part.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28851#discussion_r2631466333

Reply via email to