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

HashedPasswordFileTest.java and ExceptionTest.java can fail with java.lang.NullPointerException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 21
    • None
    • core-svc

    Description



      These two tests fail occasionally:
      test/jdk/javax/management/security/HashedPasswordFileTest.java
      test/jdk/javax/management/MBeanServer/ExceptionTest.java


      e.g an NPE in HashedPasswordFileTest at line 220: cs.stop()
      Stopping the JMXConnectorServer, but cs is null.

      testClearTextPasswordFile and other tests call createServerSide() which would set cs from a call to newJMConnectorServer().

      cs is a private variable and is never set to null, so the first test is testClearTextPasswordFile and it fails to set it.
      The other tests then go on to pass.

      createServerSide() must have thrown an exception, to avoid setting cs, but no exception is visible in the log.

      Ah, testClearTextPasswordFile must call createServerSide and get an exception, but it calls cs.stop() in a finally block, so hits the NPE before we see the exception.

      Test needs an update to not hit an NPE before showing its Exception.

      Attachments

        Issue Links

          Activity

            People

              kevinw Kevin Walls
              kevinw Kevin Walls
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: