-
Bug
-
Resolution: Done
-
Major
-
None
-
None
SourceForge Submitter: ctday .
When I try to access a StringMonitor MBean through
jmx-console, I get a ClassCastException from
javax.management.monitor.Monitor.getObservedObjects
(). The code in the HEAD of CVS reads:
public ObjectName[] getObservedObjects()
{
Set set = new HashSet(observedObjects.keySet());
elementCount = set.size();
ObjectName[] result = new ObjectName[set.size()];
alreadyNotifieds = new int[set.size()];
int count = 0;
for (Iterator i = set.iterator(); i.hasNext()
return result;
}
The Exception is raised from the (ObservedObject)
i.next, which is an ObjectName, not an ObservedObject.
The error appears to be in the initialization of set. The
keySet of the observedObjects HashMap is being used,
which is a set of ObjectNames, rather than the valueSet
of observedObjects, which is a set of ObservedObjects.
The code has been this way since at least 3.2.5.