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

REGRESSION Customization hook getImpact(MBeanOperationInfo info) of StandardMBean works improperly

XMLWordPrintable

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

      Filed By : JCK Engineering
      JDK : 1.6.0-ea-b45
      JCK : JCK6.0
      JCK test owner : http://javaweb.sfbay/jcce/tcks/jck/docs/others/owners.jto
      Failing Tests :
      api/javax_management/foundation/standard_mb/StandardMBeanTest.html#StandardMBeanTest[testStandardMBeanSubclass]
      api/javax_management/foundation/standard_mb/StandardMBeanTest.html#StandardMBeanTest[testRegisterStandardMBeanSubclass]

      Test source location:
      =====================
      /java/re/jck/6.0/promoted/beta/b04/binaries/JCK-runtime-60/tests/api/javax_management/foundation/standard_mb/StandardMBeanTest.java


      Human readable description:
      ===========================

      The investigation of failure of these two tests has shown, that the point was in the customization hook getImpact(MBeanOperationInfo info) of StandardMBean, that now works improperly.


      The problem may be constricted to the following equivalent test code:
      ---------------------------------------------------------------------
      public class StandartMBeanTest {

          // Suppose we have some MBean interface
          public interface MyMBeanMBean {
              public void method();
          }

          // And the following MBean class
          public static class MyMBean extends StandardMBean implements MyMBeanMBean {
              public MyMBean() throws NotCompliantMBeanException {
                  super(null);
              }

              // Where we "redefine this method in order to supply our
              // custom impact flag" (C) JavaDoc
              protected int getImpact(MBeanOperationInfo info) {
                  return MBeanOperationInfo.ACTION;
              }

              public void method() {
              }
          }
       
          static public void main(String[] argv) {
              try {
                 MyMBean myMBean = new MyMBean();
              
                 MBeanInfo mbInfo = myMBean.getMBeanInfo();
                 MBeanOperationInfo[] ops = mbInfo.getOperations();
                 for (int ind = 0; ind < ops.length; ind++) {
                     System.out.println("Operation " + ind + ": " + ops[ind].getName());
                     System.out.println("Impact: " + ops[ind].getImpact());
                 }
              } catch (Throwable e) {
                  e.printStackTrace();
              }
          }
      }
      ---------------------------------------------------------------------

      This code produces the following output.
      On JDK b44 and less:
      ------------
      Operation 0: method
      Impact: 1
      ------------
      (Which is the same as MBeanOperationInfo.ACTION)

      Since JDK b45:
      ------------
      Operation 0: method
      Impact: 3
      ------------
      (Which is the same as MBeanOperationInfo.UNKNOWN)


      We suppose, there were some changes in JDK b45, which resulted in improper behaviour of this feature.

            lmalvent Luis-Miguel Alventosa (Inactive)
            ashusher Alexander Shusherov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: