JDK-4625722 : java.util.logging.Level(null, int[, String]) doesn't throw NPE
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Affected Version: 1.4.0,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_7
  • CPU: generic,sparc
  • Submitted: 2002-01-18
  • Updated: 2017-05-16
  • Resolved: 2003-08-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description
Name: sdR10048			Date: 01/18/2002


JDK1.4rc91 constuctor

protected java.util.logging.Level(String name,
                                  int value,
                                  String resourceBundleName)

does not throw NullPointerException if 'name' == null.

Level(String, int) has the same problem.

Package level spec for java.util.logging says:
----------
Null Pointers

In general, unless otherwise noted in the javadoc, methods and
contructors 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 log, logp, log, severe,
warning, config, fine, finer, and finest methods) will accept null
values for all arguments except for the initial Level argument (if
any).

Consturctor spec says:
----------
protected Level(String name,
                int value,
                String resourceBundleName)

Create a named Level with a given integer value and a given localization resource name.

Parameters:
  name - the name of the Level, for example "SEVERE".
  value - an integer value for the level.
  resourceBundleName - name of a resource bundle to use in localizing
                       the given name (may be null). 

Demo test:
----------
import java.util.logging.*;

public class Test extends Level {

    public Test(String name, int value) {
        super(name, value);
    }

    public Test(String name, int value, String resourceBundleName) {
        super(name, value, resourceBundleName);
    }

    public static void main(String[] args) {
        try {
            new Test(null, 1, "");
            System.out.println("No NPE.");
        } catch (NullPointerException e) {
            System.out.println( "NPE." );
        }
    }

}

Demo output:
----------
[archer] ~/tmp
% /set/jdk-builds/JDK1.4.0rc-b91/solaris/bin/java Test
No NPE.
        
======================================================================
###@###.### 2004-09-14

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b18 VERIFIED IN: 1.5
2004-09-15

EVALUATION ^C ###@###.### 2002-05-28 The analysis is correct ###@###.### 2003-07-23 New specification through CCC is /** * Create a named Level with a given integer value and a * given localization resource name. * <p> * @param name the name of the Level, for example "SEVERE". * @param value an integer value for the level. * @param resourceBundleName name of a resource bundle to use in * localizing the given name (may be null). * @throws NullPointerException if the name is null */ protected Level(String name, int value, String resourceBundleName) { ###@###.### 2003-09-09
2003-09-09