Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6529536

Crash in constructor for javax.management.ImmutableDescriptor when debug is enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • core-svc

      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.

            Unassigned Unassigned
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: