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

Underspecified API: java.util.logging.LogManager#getLogger - null name argument

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 7
    • core-libs

      A DESCRIPTION OF THE PROBLEM :
      It is unspecified what happens when name is null.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      getLogger is the companion to addLogger so it should be similar:

      http://download.oracle.com/javase/7/docs/api/java/util/logging/LogManager.html#addLogger(java.util.logging.Logger)

      "Throws:
      NullPointerException - if the logger name is null."
      ACTUAL -
      No throws section but the current implementation throws a NPE:

      public class Main {
          public static void main(String[] args) {
              java.util.logging.LogManager.getLogManager().getLogger(null);
          }
      }

      =>

      Exception in thread "main" java.lang.NullPointerException
      at java.util.Hashtable.get(Hashtable.java:334)
      at java.util.logging.LogManager.getLogger(LogManager.java:558)
      at Main.main(Main.java:7)

      URL OF FAULTY DOCUMENTATION :
      http://download.oracle.com/javase/7/docs/api/java/util/logging/LogManager.html#getLogger(java.lang.String)

            dfuchs Daniel Fuchs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: