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

[embedded] The test Access_JTreg/Automated/test/javax/swing/JPopupMenuTest.java fails with NPE

XMLWordPrintable

      The test Access_JTreg/Automated/test/javax/swing/JPopupMenuTest.java fails with the following exception:

      [2015-04-13T02:05:26.37] java.lang.NullPointerException
      [2015-04-13T02:05:26.37] at JPopupMenuTest.start(JPopupMenuTest.java:125)
      [2015-04-13T02:05:26.37] at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:145)
      [2015-04-13T02:05:26.37] at java.lang.Thread.run(Unknown Source)
      [2015-04-13T02:05:26.37] STATUS:Failed.Applet thread threw exception: java.lang.NullPointerException

      Reproducible: Very rarely
      Is it a Regression: Not sure. I wasn't able to reproduce the issue on 8u33 b05, however, the first time it appeared was 8 b20.
      Steps to reproduce: (On Linux) Run the following command and wait till the test fails:

      while true; do DISPLAY=:0 java com.sun.javatest.regtest.AppletWrapper JPopupMenuTest.java/JPopupMenuTest.aarg; done

      I found that the test don't handle any exceptions in the method start() and this makes it impossible to obtain the error report. Here's a snippet from the test code:

      public void start() {
          try { Thread.sleep(3000); } catch (Exception e) {}
          activatePopupMenuRobotically();

          AccessibleContext ac = comp.getAccessibleContext();

          /*******************************************************
           * AccessibleContext methods.
           *******************************************************/

          if(ac == null) {
            addFailure("getAccessibleContext returned null!");
          }
      ...
          // AccessibleValue
          AccessibleValue aval = ac.getAccessibleValue();
          if(aval != null) {
              addFailure("getAccessibleValue should not return a non-null value");
          }
          report();
      }

      As it shown above, there's no chance to get the message 'getAccessibleContext returned null!'. The report method will never be invoked due to NPE occurring right before it's called. I put the report method into finally block and got the following message:

      java.lang.RuntimeException: JPopupMenuTest test failed:
      getAccessibleParent should not return null because this JPopupMenu has the parents

              at BaseTestUtil.report(BaseTestUtil.java:89)
              at JBaseTest.report(JBaseTest.java:24)
              at JPopupMenuTest.start(JPopupMenuTest.java:197)
              at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:145)
              at java.lang.Thread.run(Unknown Source)

            ptbrunet Pete Brunet (Inactive)
            dkononenko Denis Kononenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: