[ http://jira.jboss.com/jira/browse/JBJMX-86?page=comments#action_12316459 
]
     
Michael Kopp commented on JBJMX-86:
-----------------------------------

Well, I have an mbean that extends StandardMBean. The only attribute it has to 
be set from the -service.xml is an xml element. This worked well all the time. 
I now had to step back from java 1.5 to 1.4 and thus use the jboss 
implementation of jmx instead of the jdk one.

The problem is that the actual object to be set is of course a subclass of 
org.w3c.Element and thus the method with that specific subclass as a parameter 
is not found by the StandardMBean.

I think this problem will occur every time the attribute type is an interface 
and one tries to set it.

e.g. The attribute is of type java.lang.Map. Now if code of mine is calling the 
setAttribute for this attribute it will give it an actual implementation of the 
Map like java.util.HashMap.
The setAttribute of StandardMBean will then try to find a setter for this 
attribute that has a parameter HashMap, and this will not find the correct 
setter which of course has a parameter of type Map.

Pls check out the setAttribute method of StandardMBean and you'll see what I 
mean.

> setAttribute does not find correct method
> -----------------------------------------
>
>          Key: JBJMX-86
>          URL: http://jira.jboss.com/jira/browse/JBJMX-86
>      Project: JBoss JMX
>         Type: Bug
>     Versions:  JBossAS-4.0.1
>     Reporter: Michael Kopp

>
>
> The setAttribute searches for a method:
> Class[] clArr = null;
> if (attribute.getValue() != null)
> {
>    clArr = new Class[]{attribute.getValue().getClass()};
> }
> Method method = implementation.getClass().getMethod("set" + 
> attribute.getName(), clArr);
> This means that if the value is DomElement, the class would be a 
> org.apache.xerces.dom.DeferredElementImpl. But the Setter would normally 
> reference org.w3c.dom.Element.
> The feature of jboss to support Element in a -service.xml is pretty useless 
> this way.
> I think this should be done in the same way as Java5 does it. search for a 
> method with the right name and the right number of parameters. for the found 
> ones, check if the paramters are assignable. This way subclass and 
> implementations of interfaces can be supported.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to