JDK-4483991 : LOGGING APIs: Undeterminate situation with MemoryHandler property
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Priority: P4
  • Affected Version: 1.4.0,1.4.2,5.0
  • OS: generic,solaris_7
  • CPU: generic,sparc
  • Submit Date: 2001-07-25
  • Updated Date: 2017-05-16
  • Resolved Date: 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 Availabitlity Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Duplicate :  
Relates :  
Description

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.

======================================================================

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

EVALUATION Spec should be cleared up ###@###.### 2003-07-24 specification update per CCC * By default each <tt>MemoryHandler</tt> is initialized using the following * LogManager configuration properties. If properties are not defined * (or have invalid values) then the specified default values are used. * If no default value is defined then a RuntimeException is thrown. * <ul> * <li> java.util.logging.MemoryHandler.level * specifies the level for the <tt>Handler</tt> * (defaults to <tt>Level.ALL</tt>). * <li> java.util.logging.MemoryHandler.filter * specifies the name of a <tt>Filter</tt> class to use * (defaults to no <tt>Filter</tt>). * <li> java.util.logging.MemoryHandler.size * defines the buffer size (defaults to 1000). * <li> java.util.logging.MemoryHandler.push * defines the <tt>pushLevel</tt> (defaults to <tt>level.SEVERE</tt>). * <li> java.util.logging.MemoryHandler.target * specifies the name of the target <tt>Handler </tt> class. * (no default). * </ul> ###@###.### 2003-09-09
2003-09-09