-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b61
-
generic
-
generic
Case: MXBean class implements two JMX compliant MXBean interfaces which are not subinterfaces of each other.
Action: trying to register in MBeanServer using registerMBean or createMBean method
Supposed result: NotCompliantMBeanException thrown
Factual result: IllegalArgumentException thrown
While spec says:
"...If none of these conditions is met, the MBean is invalid and the attempt to register it will generate NotCompliantMBeanException."
Some excerpts from code:
-------------------------
// JMX compliant MXBean interface
@MXBean(true)
public interface MXBC_Simple03 {}
// JMX compliant MXBean interface
public interface MXBC_Simple01MXBean {}
// JMX non-compliant MXBean (NotCompliantMBeanException must be thrown)
public static class MXBNC_SimpleClass08 implements MXBC_Simple01MXBean, MXBC_Simple03 {}
-------------------------
Thrown exception:
----------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Class javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBNC_SimpleClass08 implements more than one MXBean interface: [interface javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBC_Simple01MXBean, interface javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBC_Simple03]
at com.sun.jmx.mbeanserver.MXBeanSupport.findMXBeanInterface(MXBeanSupport.java:115)
at com.sun.jmx.mbeanserver.Introspector.getMXBeanInterface(Introspector.java:289)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:145)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:305)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:479)
at javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest.testInvalidMXBeanReg(MXBeanDefTest.java:291)
at javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest.testNonCompliantMXBeans00029(MXBeanDefTest.java:1224)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd$Version2Test.execute(ExecJCKTestSameJVMCmd.java:389)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd$StandardTest.run(ExecJCKTestSameJVMCmd.java:334)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd.execute(ExecJCKTestSameJVMCmd.java:211)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd.run(ExecJCKTestSameJVMCmd.java:140)
at com.sun.javatest.agent.Agent$Task.executeCommand(Agent.java:818)
at com.sun.javatest.agent.Agent$Task.execute(Agent.java:749)
at com.sun.javatest.agent.Agent$Task.handleRequest(Agent.java:610)
at com.sun.javatest.agent.Agent.handleRequestsUntilClosed(Agent.java:377)
at com.sun.javatest.agent.Agent.access$000(Agent.java:41)
at com.sun.javatest.agent.Agent$1.run(Agent.java:253)
at java.lang.Thread.run(Thread.java:611)
----------------------------------------------------------------------------------------
Action: trying to register in MBeanServer using registerMBean or createMBean method
Supposed result: NotCompliantMBeanException thrown
Factual result: IllegalArgumentException thrown
While spec says:
"...If none of these conditions is met, the MBean is invalid and the attempt to register it will generate NotCompliantMBeanException."
Some excerpts from code:
-------------------------
// JMX compliant MXBean interface
@MXBean(true)
public interface MXBC_Simple03 {}
// JMX compliant MXBean interface
public interface MXBC_Simple01MXBean {}
// JMX non-compliant MXBean (NotCompliantMBeanException must be thrown)
public static class MXBNC_SimpleClass08 implements MXBC_Simple01MXBean, MXBC_Simple03 {}
-------------------------
Thrown exception:
----------------------------------------------------------------------------------------
java.lang.IllegalArgumentException: Class javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBNC_SimpleClass08 implements more than one MXBean interface: [interface javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBC_Simple01MXBean, interface javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest$MXBC_Simple03]
at com.sun.jmx.mbeanserver.MXBeanSupport.findMXBeanInterface(MXBeanSupport.java:115)
at com.sun.jmx.mbeanserver.Introspector.getMXBeanInterface(Introspector.java:289)
at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:145)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:305)
at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:479)
at javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest.testInvalidMXBeanReg(MXBeanDefTest.java:291)
at javasoft.sqe.tests.api.javax.management.foundation.MXBean.MXBeanDefTest.testNonCompliantMXBeans00029(MXBeanDefTest.java:1224)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:399)
at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd$Version2Test.execute(ExecJCKTestSameJVMCmd.java:389)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd$StandardTest.run(ExecJCKTestSameJVMCmd.java:334)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd.execute(ExecJCKTestSameJVMCmd.java:211)
at com.sun.jck.lib.ExecJCKTestSameJVMCmd.run(ExecJCKTestSameJVMCmd.java:140)
at com.sun.javatest.agent.Agent$Task.executeCommand(Agent.java:818)
at com.sun.javatest.agent.Agent$Task.execute(Agent.java:749)
at com.sun.javatest.agent.Agent$Task.handleRequest(Agent.java:610)
at com.sun.javatest.agent.Agent.handleRequestsUntilClosed(Agent.java:377)
at com.sun.javatest.agent.Agent.access$000(Agent.java:41)
at com.sun.javatest.agent.Agent$1.run(Agent.java:253)
at java.lang.Thread.run(Thread.java:611)
----------------------------------------------------------------------------------------