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

LogManager class initialization throws NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3 P3
    • None
    • 7u40
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.7.0_40"
      Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Java Web Start

      A DESCRIPTION OF THE PROBLEM :
      Set a value in java.util.logging.config.class to a class that does nothing.

      When the LogManager class is initialized in a Java Web Start application, a NullPointerException is thrown.

      The exception does not occur when the application main class is directly launched in a JVM.

      REGRESSION. Last worked in version 7u25

      REGRESSION : Additional Information
      The issue is coming from the changes made to correct bug JDK-8017174.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Launch the application through Java Web Start

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception and LogManager is correctly initialized with only a default logger without any handler.
      ACTUAL -
      NullPointerException exception is thrown

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException
      at java.util.logging.Logger.setParent(Unknown Source)
      at java.util.logging.LogManager$6.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.util.logging.LogManager.doSetParent(Unknown Source)
      at java.util.logging.LogManager.access$1100(Unknown Source)
      at java.util.logging.LogManager$LogNode.walkAndSetParent(Unknown Source)
      at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source)
      at java.util.logging.LogManager$LoggerContext.addLocalLogger(Unknown Source)
      at java.util.logging.LogManager.addLogger(Unknown Source)
      at java.util.logging.LogManager$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.util.logging.LogManager.<clinit>(Unknown Source)
      at Main.main(Main.java:46)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.logging.LogManager;


      public class Main
      {

          public static class DummyJDKConfigClass
          {

              public DummyJDKConfigClass()
              {
            // Do not initialize anything
              }

          }

          public static void main(String[] args)
          {
              System.setProperty("java.util.logging.config.class", DummyJDKConfigClass.class.getName());

              Thread currentThread = Thread.currentThread();
              ClassLoader previousClassLoader = currentThread.getContextClassLoader();
              try
              {
                  // change the current thread class loader so the LogManager can find our class
                  currentThread.setContextClassLoader(Main.class.getClassLoader());

                  LogManager.getLogManager();
              }
              finally
              {
                  currentThread.setContextClassLoader(previousClassLoader);
              }
          }

      }

      ---------- END SOURCE ----------

            dfuchs Daniel Fuchs
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: