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

StandardMBean(Object, Class) constructor throws NullPointerException

XMLWordPrintable

    • tiger
    • generic
    • generic
    • Verified



      Name: poR10007 Date: 09/08/2003



      The StandardMBean(Object implementation, Class mbeanInterface) constructor
      throws NullPointerException instead of NotCompliantMBeanException if the
      given implementation does not implement a management interface.
      The following test fails running on 1.5.0-beta-b18 but passes running on
      1.5.0-beta-b17. See below the test source and execution log:

      ---Test.java--------------------------------------------------------------------
      import javax.management.NotCompliantMBeanException;
      import javax.management.StandardMBean;

      public class Test {
          public static void main (String args[] ) {
      try {
      new StandardMBean(new Object(), null);
      } catch (NotCompliantMBeanException e) {
      System.out.println("Ok");
              } catch (Exception e) {
      e.printStackTrace();
      }
          }
      }
      --------------------------------------------------------------------------------

      ---Execution log----------------------------------------------------------------
      $ jdk1.5.0-b18/solaris-sparc/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b18)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b18, mixed mode)
      $ jdk1.5.0-b18/solaris-sparc/bin/javac -d . Test.java
      $ jdk1.5.0-b18/solaris-sparc/bin/java Test; echo $?
      java.lang.NullPointerException
              at com.sun.jmx.mbeanserver.Introspector.testCompliance(Introspector.java:196)
              at com.sun.jmx.mbeanserver.StandardMetaDataImpl.buildMBeanInfo(StandardMetaDataImpl.java:134)
              at com.sun.jmx.mbeanserver.StandardMetaDataImpl.testCompliance(StandardMetaDataImpl.java:160)
              at javax.management.StandardMBean.setImplementation(StandardMBean.java:340)
              at javax.management.StandardMBean.<init>(StandardMBean.java:247)
              at javax.management.StandardMBean.<init>(StandardMBean.java:271)
              at Test.main(Test.java:7)
      0
      $ jdk1.5.0-b17/solaris-sparc/bin/java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b17)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b17, mixed mode)
      $ jdk1.5.0-b17/solaris-sparc/bin/java Test; echo $?
      Ok
      0
      $
      --------------------------------------------------------------------------------

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

            emcmanus Eamonn McManus
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: