-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b53
-
generic
-
generic
-
Verified
When you call a getter on an MXBean
AND that getter returns null
AND the getter is called by Java in order to reconstruct the instance from the CompositeData
then you get for now (b45) an MBeanException that wraps a NullPointerException.
That case as described in the MXBean annotation type in the javadoc does not go up to that level of details.
javax.management.MBeanException: interface Bug$TestMXBean.getB: cannot convert return value to open value: javax.management.openmbean.OpenDataException: Error calling getter for something: java.lang.NullPointerException
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:172)
at com.sun.jmx.mbeanserver.MXBeanSupport$MBeanDispatcher.getAttribute(MXBeanSupport.java:302)
at com.sun.jmx.mbeanserver.MXBeanSupport.getAttribute(MXBeanSupport.java:190)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.getAttribute(DynamicMetaDataImpl.java:83)
at com.sun.jmx.mbeanserver.MetaDataImpl.getAttribute(MetaDataImpl.java:144)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:688)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:649)
at Bug.run(Bug.java:18)
at Bug.main(Bug.java:25)
Caused by: javax.management.openmbean.OpenDataException: Error calling getter for something: java.lang.NullPointerException
at com.sun.jmx.mbeanserver.OpenConverter.openDataException(OpenConverter.java:1333)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:775)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:167)
... 8 more
Caused by: java.lang.NullPointerException
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:585)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:772)
... 9 more
As of Mustang b45, the Descriptor.setFields() javadoc says (extract):
[...]
Throws:
RuntimeOperationsException - if the change fails for any reason. Wrapped exception is IllegalArgumentException if fieldNames or fieldValues is null, or if the arrays are of different lengths, or if there is an illegal value in one of them. Wrapped exception is UnsupportedOperationException if the descriptor is immutable, and the call would change its contents.
[...]
and the ImmutableDescriptor.setFields() javadoc says (extract):
[...]
Throws:
RuntimeOperationsException - for illegal value for field Names or field Values. Neither can be null. The array lengths must be equal. If the call would succeed on a mutable descriptor and change its contents, then this exception will be thrown and the wrapped exception will be UnsupportedOperationException.
[...]
1) The latter javadoc should be aligned on the former.
2) The current implementation is not compliant in the case there is an illegal value in the fieldNames array. With both empty String and null values, a RuntimeOperationsException is effectively thrown but the awaited wrapped IllegalArgumentException is not there.
Notice modelmbean.DescriptorSupport.setFields() does the expected exception wrapping (so there is an asymmetry).
Now the fix for the 6267824 has been pushed in b43, the javadoc says how is ordered the array returned by getFieldValues(null). So the test should check it.
Now that the fix for the 6273613 has been pushed in b45, it becomes valid to uncomment the exception wrapping test code that was up to now commented out in api/tests/javax_management/foundation/Descriptor/MethodsTest.java
The issue has been seen between two jvm, one started with management on and the other using MXBean proxies for the java.lang.management MXBeans.
The client and server are running Mustang b45.
The client calls getThreadInfo(long[] ids) and provides as ids value what has been returned by getAllThreadIds().
Then client gets:
java.lang.reflect.UndeclaredThrowableException
at $Proxy2.getThreadInfo(Unknown Source)
at javasoft.sqe.jmx.test.functional.MXBeanTest1.doThreadMXBeanTest(MXBeanTest1.java:241)
at javasoft.sqe.jmx.test.functional.MXBeanTest1.run(MXBeanTest1.java:93)
at javasoft.sqe.jmx.share.TestStarter.<init>(TestStarter.java:40)
at javasoft.sqe.jmx.share.TestStarter.main(TestStarter.java:98)
Caused by: javax.management.ReflectionException
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:649)
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:94)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:200)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:183)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:865)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:772)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:65)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1340)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:774)
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:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:496)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:737)
at java.lang.Thread.run(Thread.java:608)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:143)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:973)
at com.sun.jmx.mbeanserver.MXBeanInvocationHandler$InvokeHandler.invoke(MXBeanInvocationHandler.java:152)
at com.sun.jmx.mbeanserver.MXBeanInvocationHandler.invoke(MXBeanInvocationHandler.java:191)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:311)
... 5 more
Caused by: java.lang.NoSuchMethodException: Operation getThreadInfo does not exist.
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:649)
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:94)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:200)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:183)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:865)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:772)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:65)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1340)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:774)
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:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:496)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:737)
at java.lang.Thread.run(Thread.java:608)
AND that getter returns null
AND the getter is called by Java in order to reconstruct the instance from the CompositeData
then you get for now (b45) an MBeanException that wraps a NullPointerException.
That case as described in the MXBean annotation type in the javadoc does not go up to that level of details.
javax.management.MBeanException: interface Bug$TestMXBean.getB: cannot convert return value to open value: javax.management.openmbean.OpenDataException: Error calling getter for something: java.lang.NullPointerException
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:172)
at com.sun.jmx.mbeanserver.MXBeanSupport$MBeanDispatcher.getAttribute(MXBeanSupport.java:302)
at com.sun.jmx.mbeanserver.MXBeanSupport.getAttribute(MXBeanSupport.java:190)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.getAttribute(DynamicMetaDataImpl.java:83)
at com.sun.jmx.mbeanserver.MetaDataImpl.getAttribute(MetaDataImpl.java:144)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:688)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:649)
at Bug.run(Bug.java:18)
at Bug.main(Bug.java:25)
Caused by: javax.management.openmbean.OpenDataException: Error calling getter for something: java.lang.NullPointerException
at com.sun.jmx.mbeanserver.OpenConverter.openDataException(OpenConverter.java:1333)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:775)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:167)
... 8 more
Caused by: java.lang.NullPointerException
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:585)
at com.sun.jmx.mbeanserver.OpenConverter$CompositeConverter.toOpenValue(OpenConverter.java:772)
... 9 more
As of Mustang b45, the Descriptor.setFields() javadoc says (extract):
[...]
Throws:
RuntimeOperationsException - if the change fails for any reason. Wrapped exception is IllegalArgumentException if fieldNames or fieldValues is null, or if the arrays are of different lengths, or if there is an illegal value in one of them. Wrapped exception is UnsupportedOperationException if the descriptor is immutable, and the call would change its contents.
[...]
and the ImmutableDescriptor.setFields() javadoc says (extract):
[...]
Throws:
RuntimeOperationsException - for illegal value for field Names or field Values. Neither can be null. The array lengths must be equal. If the call would succeed on a mutable descriptor and change its contents, then this exception will be thrown and the wrapped exception will be UnsupportedOperationException.
[...]
1) The latter javadoc should be aligned on the former.
2) The current implementation is not compliant in the case there is an illegal value in the fieldNames array. With both empty String and null values, a RuntimeOperationsException is effectively thrown but the awaited wrapped IllegalArgumentException is not there.
Notice modelmbean.DescriptorSupport.setFields() does the expected exception wrapping (so there is an asymmetry).
Now the fix for the 6267824 has been pushed in b43, the javadoc says how is ordered the array returned by getFieldValues(null). So the test should check it.
Now that the fix for the 6273613 has been pushed in b45, it becomes valid to uncomment the exception wrapping test code that was up to now commented out in api/tests/javax_management/foundation/Descriptor/MethodsTest.java
The issue has been seen between two jvm, one started with management on and the other using MXBean proxies for the java.lang.management MXBeans.
The client and server are running Mustang b45.
The client calls getThreadInfo(long[] ids) and provides as ids value what has been returned by getAllThreadIds().
Then client gets:
java.lang.reflect.UndeclaredThrowableException
at $Proxy2.getThreadInfo(Unknown Source)
at javasoft.sqe.jmx.test.functional.MXBeanTest1.doThreadMXBeanTest(MXBeanTest1.java:241)
at javasoft.sqe.jmx.test.functional.MXBeanTest1.run(MXBeanTest1.java:93)
at javasoft.sqe.jmx.share.TestStarter.<init>(TestStarter.java:40)
at javasoft.sqe.jmx.share.TestStarter.main(TestStarter.java:98)
Caused by: javax.management.ReflectionException
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:649)
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:94)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:200)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:183)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:865)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:772)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:65)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1340)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:774)
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:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:496)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:737)
at java.lang.Thread.run(Thread.java:608)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:143)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:973)
at com.sun.jmx.mbeanserver.MXBeanInvocationHandler$InvokeHandler.invoke(MXBeanInvocationHandler.java:152)
at com.sun.jmx.mbeanserver.MXBeanInvocationHandler.invoke(MXBeanInvocationHandler.java:191)
at javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:311)
... 5 more
Caused by: java.lang.NoSuchMethodException: Operation getThreadInfo does not exist.
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:649)
at sun.management.MXBeanSupport.invoke(MXBeanSupport.java:94)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:200)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:183)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:865)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:772)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:65)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1340)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:774)
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:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:496)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:737)
at java.lang.Thread.run(Thread.java:608)
- relates to
-
JDK-6319309 MXBean proxy for java.lang.management.ThreadMXBean gets NullPointerException
- Resolved
-
JDK-6321363 MXBean spec should say how null values are handled
- Resolved