RFR 8129215: com.sun.jmx.mbeanserver.Introspector may provide results inconsistent with the JavaBeans Introspector

Jaroslav Bachorik jaroslav.bachorik at oracle.com
Thu Jun 18 17:16:31 UTC 2015

On 18.6.2015 18:47, Daniel Fuchs wrote:
> Hi Jaroslav,
> I haven't looked at the code, but if I understand well,
> that would be a spec change.
> Attribute names are case sensitive in JMX.
> getFoo() =>  attribute named "Foo"
> getfoo() =>  attribute named "foo"
> Are you proposing to change that?

In this case it is an even bigger mess. This would work as long as you 
don't go through the JavaBeans introspector. The property descriptor 
generated for the "getFoo" method will be named "foo" and it is 
indistinguishable from "getfoo". Therefore, when you are trying to reach 
this attribute as "Foo" the JavaBeans introspector will not resolve the 
getter name. The SimpleIntrospector, on the other hand, will.

I am proposing to change the SimpleIntrospector so it behaves exactly as 
the JavaBeans introspector. But it seems that even that might be 
considered a specification change :/


> best regards,
> -- daniel
> On 18/06/15 18:39, Jaroslav Bachorik wrote:
>> Please, review the following change
>> Issue : https://bugs.openjdk.java.net/browse/JDK-8129215
>> Webrev: http://cr.openjdk.java.net/~jbachorik/8129215/webrev.00
>> The JMX Introspector will try to use the JavaBeans introspector whenever
>> possible, delegating the requests for the property getter/setter
>> methods. However, when the JavaBeans introspector is not available
>> (modules) the JMX Introspector falls back to its own simple, reflection
>> based, algorithm.
>> The simple algorithm does not enforce the rule of property names
>> starting with a lower-case letter. This might lead to situations when
>> the simple introspector provides the getter method for an attribute the
>> JavaBeans introspector would not (eg. 'Attribute' attribute)
>> This patch changes the simple introspector behaviour to conform to the
>> one of the JavaBeans introspector. Also, it makes the simple
>> introspector called only when the JavaBeans introspector is not
>> available - and not when the JavaBeans introspector fails to resolve a
>> property getter.
>> Thanks,
>> -JB-

More information about the serviceability-dev mailing list