[
https://issues.apache.org/jira/browse/GROOVY-2807?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Sun reassigned GROOVY-2807:
----------------------------------
Assignee: Daniel Sun
> GroovyMBean does not support the use of overloaded MBean operations that have
> the same number of parameters
> -----------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-2807
> URL: https://issues.apache.org/jira/browse/GROOVY-2807
> Project: Groovy
> Issue Type: Bug
> Components: groovy-jmx
> Reporter: Meyrick Kirby
> Assignee: Daniel Sun
> Priority: Major
> Attachments: GroovyMBean.java
>
>
> I've been using groovy.util.GroovyMBean to access MBeans running on the JBoss
> 4 server. Some of the operations/methods of the MBeans are overloaded, e.g.:
> {code}
> void redeploy(java.lang.String url)
> void redeploy(java.net.URL url)
> void redeploy(org.jboss.deployment.DeploymentInfo sdi)
> {code}
> Currently it's impossible to invoke the first 2.
> The problem is, when the GroovyMBean is constructed it stores a signature for
> each operation from its specified MBean in a HashMap, using the operation
> name and the number of parameters as its key. Later, when the invokeMethod
> method is invoked, it uses the method name and the number of parameters to
> retrieve the signature to invoke the operation on the MBean. Thus for
> overloaded operations with the same number of parameters, only the last
> operation found will be stored in the HashMap.
> If another variant of the operation is invoked on the GroovyMBean then an
> incorrect signature will be passed to the MBeanServer which results in an
> exception occurring on the server.
> The fix I've used (suggested by a comment in the source code) is to
> construct a key out of the name of the operation and the sum of the hash
> codes of the class names of the parameters.
> The problem is, this required 2 new createOperationKey methods:
> {code}
> String createOperationKey(MBeanOperationInfo opInfo)
> String createOperationKey(String method, Object[] args)
> {code}
> The first is invoked by the constructor, and the second that is invoked by
> the invokeMethod method. The original createOperationKey method is removed.
> This might create backwards compatibility problems.
> I've included an adjusted GroovyMBean class, although temporarily in a new
> package (groovy.util.adjusted).
> This issue is an extension of issue GROOVY-1291
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)