-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
other
-
generic
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.
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.
- duplicates
-
JDK-6471865 Unable to create a modelmbean.DescriptorSupport with debugging ON
- Resolved