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

(dc) NPE in MembershipRegistry.invalidateAll in close after failed attempt to join multicast group

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • core-libs
    • None
    • generic
    • generic

      The following test results in a NullPointerException (Linux only)

      import java.net.*;
      import java.nio.channels.*;

      public class Test {
          public static void main(String[] args) throws Exception {
              DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET6)
                  .setOption(StandardSocketOption.SO_REUSEADDR, true)
                  .bind(new InetSocketAddress(0));
              InetAddress group = InetAddress.getByName("ff02::a");
              NetworkInterface ni = NetworkInterface.getByName("eth0");
              InetAddress source = InetAddress.getByName("::1");
              try {
                  dc.join(group, ni, source);
              } catch (Exception x) { }

              dc.close();
          }
      }

      $ java Test
      java.lang.NullPointerException
          at sun.nio.ch.MembershipRegistry.invalidateAll(MembershipRegistry.java:123)
          at sun.nio.ch.DatagramChannelImpl.implCloseSelectableChannel(DatagramChannelImpl.java:963)
          at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:218)
          at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:111)

            alanb Alan Bateman
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: