we have executed net and nio net channel tests in IPv6 only environments (macOS, linux ubuntu, OL9, windows server 2019) SendPortZero
sample exception
Caused by: java.nio.channels.UnsupportedAddressTypeException
at java.base/sun.nio.ch.Net.checkAddress(Net.java:149)
at java.base/sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:825)
at SendPortZero.lambda$testChannelSend$1(SendPortZero.java:102)
So looking at the call flows and the checkAddress
static InetSocketAddress checkAddress(SocketAddress sa, ProtocolFamily family) {
InetSocketAddress isa = checkAddress(sa);
if (family == StandardProtocolFamily.INET) {
InetAddress addr = isa.getAddress();
if (!(addr instanceof Inet4Address))
throw new UnsupportedAddressTypeException();
}
return isa;
}
the family in this instance should be AF_INET6 or java.net.StandardProtocolFamily.INET6 as IPv4 is disabled
The following tests exhibit the same or similar inconsistent behaviour:
java/nio/channels/DatagramChannel/ConnectPortZero.java
java/nio/channels/DatagramChannel/BindNull.java
java/nio/channels/DatagramChannel/Disconnect.java
java/nio/channels/DatagramChannel/AfterDisconnect.java
sample exception
Caused by: java.nio.channels.UnsupportedAddressTypeException
at java.base/sun.nio.ch.Net.checkAddress(Net.java:149)
at java.base/sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:825)
at SendPortZero.lambda$testChannelSend$1(SendPortZero.java:102)
So looking at the call flows and the checkAddress
static InetSocketAddress checkAddress(SocketAddress sa, ProtocolFamily family) {
InetSocketAddress isa = checkAddress(sa);
if (family == StandardProtocolFamily.INET) {
InetAddress addr = isa.getAddress();
if (!(addr instanceof Inet4Address))
throw new UnsupportedAddressTypeException();
}
return isa;
}
the family in this instance should be AF_INET6 or java.net.StandardProtocolFamily.INET6 as IPv4 is disabled
The following tests exhibit the same or similar inconsistent behaviour:
java/nio/channels/DatagramChannel/ConnectPortZero.java
java/nio/channels/DatagramChannel/BindNull.java
java/nio/channels/DatagramChannel/Disconnect.java
java/nio/channels/DatagramChannel/AfterDisconnect.java
- relates to
-
JDK-8315929 Add IPSupport::printPlatformSupport to test setup in java/nio/channels/DatagramChannel/ tests to assist IPv6 only testing
- In Progress