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

new DescriptorSupport() constructor should never throw IllegalArgumentException

XMLWordPrintable

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

      The debug logging code in this constructor throws an exception when enabled, rendering
      the constructor unusable when trying to log jmx

      Test-case - enable logging, call the constructor - it fails:


      import java.util.logging.*;
      import javax.management.modelmbean.*;
      import javax.management.*;

      public class Test {

          public static void main(String[] args) throws Exception {

              Descriptor ds = new DescriptorSupport();

              System.out.println("ds = "+ds);

              Logger logger = Logger.getLogger("");
              logger.setLevel(Level.ALL);

              Handler handler = new ConsoleHandler();
              handler.setLevel(Level.ALL);

              logger.addHandler(handler);

              ds = new DescriptorSupport();

              System.out.println("ds = "+ds);



          }
      }


      Results:



      ds =
      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:22)

            Unassigned Unassigned
            nstephen Nick Stephen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: