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

[headless] JPopupMenu creation in headless mode with JDK9b23 causes NPE

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • Resolved In Build:
      b28
    • Verification:
      Verified

      Backports

        Description

        Instantiation of JPopupMenu in headless mode started to cause NPE since approximately JDK9b22.
        This problem is not observed with JDK8u5 for example.

        The following code if run with JDK9b23 with -Djava.awt.headless=true

        ------------------------------------------------------------
        public class JPM {
            public static void main(String[] args) {
                new javax.swing.JPopupMenu();
            }
        }
        ------------------------------------------------------------

        results in

        Exception in thread "main" java.lang.NullPointerException
        at javax.swing.RepaintManager.currentManager(RepaintManager.java:263)
        at javax.swing.JComponent.repaint(JComponent.java:4802)
        at java.awt.Component.repaint(Component.java:3372)
        at javax.swing.JComponent.setBorder(JComponent.java:1802)
        at javax.swing.LookAndFeel.installBorder(LookAndFeel.java:229)
        at javax.swing.plaf.basic.BasicPopupMenuUI.installDefaults(BasicPopupMenuUI.java:102)
        at javax.swing.plaf.basic.BasicPopupMenuUI.installUI(BasicPopupMenuUI.java:91)
        at javax.swing.JComponent.setUI(JComponent.java:666)
        at javax.swing.JPopupMenu.setUI(JPopupMenu.java:220)
        at javax.swing.JPopupMenu.updateUI(JPopupMenu.java:229)
        at javax.swing.JPopupMenu.<init>(JPopupMenu.java:194)
        at javax.swing.JPopupMenu.<init>(JPopupMenu.java:179)
        at JPM.main(JPM.java:3)


        The following JCK9 tests fail due to this issue


        api/javax_swing/JPopupMenu/descriptions.html#updateUI
        api/javax_swing/JPopupMenu/descriptions.html#getAccessibleXXX
        api/javax_swing/JPopupMenu/descriptions.html#insert
        api/javax_swing/JPopupMenu/descriptions.html#Action
        api/javax_swing/JPopupMenu/descriptions.html#GetXXXListeners
        api/javax_swing/JPopupMenu/descriptions.html#getXXX
        api/javax_swing/JPopupMenu/descriptions.html#Ctor
        api/javax_swing/JPopupMenu/AccessibleJPopupMenu/index.html#AccessibleContext
        api/javax_swing/plaf/PopupMenuUI/index.html#Ctor
        api/javax_swing/JPopupMenu/AccessibleJPopupMenu/index.html#Ctor
        api/javax_swing/JPopupMenu/Separator/index.html#Ctor
        api/javax_swing/JPopupMenu/descriptions.html#add
        api/javax_swing/JPopupMenu/descriptions.html#set_isXXX
        api/javax_swing/JPopupMenu/descriptions.html#MenuListenerXXX


        Reproduced with Windows and Solaris-sparcv9

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  alexsch Alexandr Scherbatiy
                  Reporter:
                  dbessono Dmitry Bessonov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: