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

Clhsdb "versioncheck true" throws NPE every time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • 17
    • hotspot
    • None
    • b10

      hsdb> verbose true
      hsdb> versioncheck true
      Error: java.lang.NullPointerException
      java.lang.NullPointerException
      at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
      at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
      at java.base/java.util.Properties.put(Properties.java:1312)
      at java.base/java.util.Properties.setProperty(Properties.java:229)
      at java.base/java.lang.System.setProperty(System.java:915)
      at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor$33.doit(CommandProcessor.java:1195)
      at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2095)
      at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:2065)
      at jdk.hotspot.agent/sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1936)
      at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:99)
      at jdk.hotspot.agent/sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:40)
      at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:280)
      at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:483)

                      if (t.countTokens() == 0) {
                          out.println("versioncheck is " +
                                      (System.getProperty("sun.jvm.hotspot.runtime.VM.disableVersionCheck") == null));
                      } else if (t.countTokens() == 1) {
                          if (Boolean.valueOf(t.nextToken()).booleanValue()) {
                              System.setProperty("sun.jvm.hotspot.runtime.VM.disableVersionCheck", null);
                          } else {
                              System.setProperty("sun.jvm.hotspot.runtime.VM.disableVersionCheck", "true");
                          }
                      } else {
                          usage();
                      }

      If the disableVersionCheck is null,meaning it is not set, then version checking is enabled. However, if disableVersionCheck is currently set true, the proper way to get it back to null is to call System.clearProperty(). Calling setProperty() with a null value will always cause an NPE.

      I doubt this code has ever worked. It probably hasn't been noticed since disableVersionCheck defaults to null (so version checking is enabled), and if you want it disabled you use "versioncheck false", which will set disableVersionCheck to true. Since there is very little reason to go back to it being enabled, probably this bug was never noticed.

            cjplummer Chris Plummer
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: