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

(se) Selector.wakeup on Selector interrupted by close can throw NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 6
    • core-libs
    • None
    • b10
    • x86
    • linux

        Redhat FC6 Linux 2.6.19-1.2895.fc6 #1 SMP
        Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

        Person reporting the bug is a Sun employee, but without
        bugster access (###@###.###)

        The following code produces the following exception:

        java.lang.NullPointerException
               at sun.nio.ch.EPollSelectorImpl.wakeup(EPollSelectorImpl.java:170)
               at net.jxta.impl.endpoint.tcp.TcpTransport.stopApp(TcpTransport.java:841)

        According to the API, a call to Selector.wakeup() is not required after calling Selector.close(), and arguably the call is not required, however EPollSelectorImpl should not throw an NPE.

               Thread temp = messengerSelectorThread;
               if (null != temp) {
                   temp.interrupt();
                   try {
                       messengerSelector.close();
                   } catch (IOException failed) {
                       if (LOG.isLoggable(Level.SEVERE)) {
                           LOG.log(Level.SEVERE, "IO error occured while closing server socket", failed);
                       }
                   }
               }

               // in case interrupt did not wakeup the Selector
        Line:841>>> messengerSelector.wakeup();

              alanb Alan Bateman
              katleman David Katleman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: