Affects Version/s: None
Fix Version/s: None
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.:
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:
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