Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8315813

Some java/nio/channels/DatagramChannel/** Tests exhibits inconsistent behaviour in IPv6 only environments

XMLWordPrintable

      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

            msheppar Mark Sheppard
            msheppar Mark Sheppard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: