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

Null pointer handling in java.util.logging.Logger is under tested and may not always conform to specification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • core-libs
    • None

      The package.html says:

      <<
      In general, unless otherwise noted in the javadoc, methods and
      constructors will throw NullPointerException if passed a null argument.
      The one broad exception to this rule is that the logging convenience
      methods in the Logger class (the config, entering, exiting, fine, finer, finest,
      log, logp, logrb, severe, throwing, and warning methods)
      will accept null values
      for all arguments except for the initial Level argument (if any).
      >>

      I am afraid this is both not true and not tested (sigh).

      The new methods that accept a Supplier<String> may throw
      a NPE for instance if the supplier is null and the level is
      enabled. So it looks that we need to make yet another decision
      about how to bring the spec and implementation in sync here,
      and we definitely need more tests.

      There appear to be no test that verifies that you can pass a null message.
      This needs to be tested with and without the presence of ResourceBundle
      (ResourceBundle implementations may throw a NPE when given a null key).

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

              Created:
              Updated: