[ http://jira.jboss.com/jira/browse/JBJMX-3?page=history ]
     
Adrian Brock reopened JBJMX-3:
------------------------------


> Fix ClassCastException in 
> javax.management.monitor.Monitor.getObservedObjects()
> -------------------------------------------------------------------------------
>
>          Key: JBJMX-3
>          URL: http://jira.jboss.com/jira/browse/JBJMX-3
>      Project: JBoss JMX
>         Type: Patch
>  Environment: At least from Jboss 3.2.5. Still in HEAD.
>     Reporter: Christopher Day
>     Assignee: Scott M Stark

>
>
> 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()];

-- 
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://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to