-
Bug
-
Resolution: Done
-
Major
-
None
-
None
When trying to access a StringMonitor from jmx-console, I get a ClassCastException from javax.management.monitor.Monitor.getObservedObjects(). This is because the method incorrectly iterates over the keys of the observedObjects HashMap, rather than the values. The Exception is raised when the iterator.next() is cast to an ObservedObject, since the keys are ObjectNames. The following patch fixes the problem.
— Monitor.java 2004-12-22 16:57:52.207142400 -0800
+++ /cygdrive/c/jboss-3.2.5-src/jmx/src/main/javax/management/monitor/Monitor.java 2004-01-02 13:56:54.000000000 -0800
@@ -181,7 +181,7 @@
public ObjectName[] getObservedObjects()
{
- Set set = new HashSet(observedObjects.values());
+ Set set = new HashSet(observedObjects.keySet());
elementCount = set.size();
ObjectName[] result = new ObjectName[set.size()];
alreadyNotifieds = new int[set.size()];