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

Methods in ModelMBeanInfo return Mbean not ModelMBean arrays as JMX spec says

    • b38
    • x86
    • windows_2000


      ###@###.### 2004-01-20


      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)

      Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
        No.

      Operating System Configuration Information (be specific):
        Windows 2000 SP4
        Linux Redhat 7.3

      Hardware Configuration Information (be specific):
        DUAL PIII 866 MHZ
        1GB Memory


      Bug Description:
        According to the current JMX Spec (page 81) ModelMBeanInfo should return
        ModelMBean* arrays for getDescriptors(), getOperations(), getConstructors(),
        getAttributes(). In certain circumstances the inherited MBeanInfo methods
        will return Mbean* only.

        Tested it with an existing application and tracked it down to several
        cases where Mbean* were just returned. Looking at the source it seems the
        ModelMBeanInfoSupport does not overwrite the inherited MbeanInfo methods and
        thus is using the underlying MBeanInfo logic.

      Steps to Reproduce (be specific):

        Execute the provided testcase: test/ModelInfoBadReturn.java

      Test program:

      test/ModelInfoBadReturn.java:

      package test;

      /**
       * Created by IntelliJ IDEA.
       * User: jens
       * Date: Jan 17, 2004
       * Time: 3:44:46 AM
       * To change this template use File | Settings | File Templates.
       */
      public class ModelInfoBadReturn {




          public static void main(String[] args) {
              ModelMBeanInfoSupport support = new ModelMBeanInfoSupport(
                 ModelInfoBadReturn.class.getName(),
                 "Some Description",
                      new ModelMBeanAttributeInfo[0],
                      new ModelMBeanConstructorInfo[0],
                      new ModelMBeanOperationInfo[0],
                      new ModelMBeanNotificationInfo[0]
              );

              // should be ModelMBeanAttributeInfo and NOT MBeanAttributeInfo
              System.out.println(support.getAttributes().getClass().getName());
          }
      }

            emcmanus Eamonn McManus
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: