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

SwingUtilities API call throws NPE with JRE 1.8.0_51

    Details

      Description

      After an application was upgraded from using 7u21 to using 8u51, there are many NullPointerException thrown.

      On debugging, it was found SwingUtilities.<method_name> threw NPE over the RMI calls.

      Following are some problem and stack traces:

      1: Creating any Swing component in RMI thread throws NPE. In our application we create JRadioButton in RMI thread which throws the following exception:
      Exception in thread "Thread-339" java.lang.NullPointerException
              at javax.swing.SwingUtilities.appContextGet(Unknown Source)
              at javax.swing.JComponent.getDefaultLocale(Unknown Source)
              at javax.swing.JComponent.<init>(Unknown Source)
              at javax.swing.AbstractButton.<init>(Unknown Source)

      2: On calling invokeLater(), invokeAndWait(), isEventDispatchThread() methods, RMI thread throws NPE.
      These are the methods where we see the exception and there are other methods in SwingUtilities which throw NPE:
      java.lang.NullPointerException
              at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source)
              at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source)
              at sun.awt.SunToolkit.getSystemEventQueueImpl(Unknown Source)

      3: Appending text to JTextArea in RMI thread is throwing NPE:
      java.lang.NullPointerException
              at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source)
              at sun.awt.SunToolkit.getSystemEventQueueImplPP(Unknown Source)
              at sun.awt.SunToolkit.getSystemEventQueueImpl(Unknown Source)
              at java.awt.Toolkit.getEventQueue(Unknown Source)

      Looks the issues persist since 7u25. Tried the same with latest JRE i.e. 8u65 but the issues persist there too.

      JDK-8135232 looks similar and is unresolved in 8u45.

      Using SwingRmiHelper.invokelater [1] instead of SwingUtilities.invokelater didn't help.

      [1] http://www.oracle.com/technetwork/java/javase/7u51-relnotes-2085002.html
      Area: deploy/webstart
      Synopsis: Webstart applications that use RMI with SwingUtlities.invokeLater or invokeAndWait throw an NPE.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aivanov Alexey Ivanov
                Reporter:
                shadowbug Shadow Bug
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: