-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 1.4.2, 5.0
-
tiger
-
generic, sparc
-
generic, solaris_7
-
Verified
Name: elR10090 Date: 07/25/2001
The following is the paragraph from spec (Merlin-b72) for
MemoryHandler class:
"Configuration: By default each MemoryHandler is initialized
using the following LogManager configuration properties. If
properties are not defined (or have invalid values) then the
specified default values are used."
The property java.util.logging.MemoryHandler.target does not have
default value, and the specification does not clarify what might happen
if it is not set (or assigned to invalid value).
The following test shows that MemoryHandler() constructor throws unspecified
java.lang.RuntimeException if java.util.logging.MemoryHandler.target is
not set or set to unexisting handler.
import java.util.logging.*;
import java.io.*;
public class MH {
final static LogManager logManager = LogManager.getLogManager();
public static void main (String args[]) {
System.exit(95 + run(args, System.out));
}
public static int run(String args[], PrintStream out) {
try {
MemoryHandler handler = new MemoryHandler();
} catch (RuntimeException e) {
out.println("# Exception is thrown while trying to "
+ "create MemoryHandler");
e.printStackTrace(out);
}
return 0;
}
}
% ../jdk1.4.0beta-b72/solx86/bin/java MH
MemoryHandler can't load handler "null"
java.lang.NullPointerException
# Exception is thrown while trying to create MemoryHandler
java.lang.RuntimeException: Can't load null
at java.util.logging.MemoryHandler.<init>(MemoryHandler.java:103)
at MH.run(MH.java:13)
at MH.main(MH.java:8)
% cat MH.properties
java.util.logging.MemoryHandler.target=NoSuchTarget
% ../jdk1.4.0beta-b72/solx86/bin/java
-Djava.util.logging.config.file=MH.properties MH
MemoryHandler can't load handler "NoSuchTarget"
java.lang.ClassNotFoundException: NoSuchTarget
# Exception is thrown while trying to create MemoryHandler
java.lang.RuntimeException: Can't load NoSuchTarget
at java.util.logging.MemoryHandler.<init>(MemoryHandler.java:103)
at MH.run(MH.java:13)
at MH.main(MH.java:8)
Please, note, that there are two more properties that do not have default
values (in SocketHandler class):
java.util.logging.SocketHandler.host
java.util.logging.SocketHandler.port
However, constructor SocketHandler() works correctly - it throws documented
java.lang.IllegalArgumentException and java.net.UnknownHostException if
java.util.logging.SocketHandler.host or/and
java.util.logging.SocketHandler.port are not set, or invalid values are
assigned to both properties.
I guess the spec for MemoryHandler() constructor also should clarify what might
happen if no (or invalid) value is set to
java.util.logging.MemoryHandler.target.
======================================================================
- duplicates
-
JDK-4776860 java.util.logging.MemoryHandler ctor: NPE
-
- Closed
-
- relates to
-
JDK-4948295 MemoryHandler() prints to stderr along with RuntimeException
-
- Resolved
-