-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
sparc
-
solaris_7
Name: sdR10048 Date: 11/10/2002
-- T.java --
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
class MyFormatter extends Formatter {
public MyFormatter() {
}
public String format(LogRecord record) {
return "";
}
}
class T {
public static void main(String args[]) {
MyFormatter formatter = new MyFormatter();
formatter.getHead(null);
formatter.getTail(null);
System.out.println("No NPE.");
}
}
-- Output --
No NPE.
------------
Javadoc says:
(1)
public String getHead(Handler h)
Return the header string for a set of formatted records.
This base class returns an empty string, but this may be overriden by
subclasses.
Parameters:
h - The target handler.
Returns:
header string
(2)
doc/api/java/util/logging/package-summary.html
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 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).
======================================================================
- duplicates
-
JDK-4486754 LOGGING APIs: Expected NullPointerException isn't thrown
- Closed