JDK-6529536 : Crash in constructor for javax.management.ImmutableDescriptor when debug is enabled
  • Type: Bug
  • Component: core-svc
  • Sub-Component: javax.management
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: other
  • Submitted: 2007-02-28
  • Updated: 2010-07-29
  • Resolved: 2007-02-28
Related Reports
Duplicate :  
Description
Testcase is as follows :-

import javax.management.modelmbean.*;
import java.util.logging.LogManager;
public class test {
    public static void main(String[] args)  {
        DescriptorSupport ds = new DescriptorSupport();
        LogManager.getLoggingMXBean().setLoggerLevel("javax.management.modelmbean", "ALL");
        ds = new DescriptorSupport();
    }
}

Stack trace is :-

Exception in thread "main" java.lang.IllegalArgumentException: Null Map
        at javax.management.ImmutableDescriptor.<init>(ImmutableDescriptor.java:85)
        at javax.management.modelmbean.DescriptorSupport.hashCode(DescriptorSupport.java:777)
        at javax.management.modelmbean.DescriptorSupport.debug(DescriptorSupport.java:1260)
        at javax.management.modelmbean.DescriptorSupport.debug(DescriptorSupport.java:1266)
        at javax.management.modelmbean.DescriptorSupport.<init>(DescriptorSupport.java:160)
        at test.main(test.java:7)

This occurs because the DescriptorSupport code tries to log the DescriptorSupport object's hashCode, which is generated by creating an ImmutableDescriptor, passing the Map which underlies the DescriptorSupport object. This Map hasn't been initialised yet...

If the Map is initialised with its definition rather than in the "init()" method (a method, not the constructor) the issue is avoided.

Comments
EVALUATION This is the same as 6471865 which is fixed in JDK 6 update 2.
28-02-2007

WORK AROUND Don't try and enable logging.
28-02-2007