[ mx4j-Bugs-977253 ] ClassCastException when trying to browse TabularData

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.mx4j.devel
Message-ID <[email protected]>
Bugs item #977253, was opened at 2004-06-22 09:04
Message generated for change (Comment added) made by basdebakker
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=977253&group_id=47745

Category: HTTP Adaptor
Group: Release 2.0.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Lars Kühne (lkuehne)
Assigned to: Nobody/Anonymous (nobody)
Summary: ClassCastException when trying to browse TabularData

Initial Comment:
I have implemented an OpenMBean that has an attribute
of type TabularData. The getter method is implemented
using TabularDataSupport, basically:

  TabularDataSupport tabularDataSupport = new
TabularDataSupport(...);
  tabularDataSupport.put(new CompositeDataSupport(...));
  tabularDataSupport.put(new CompositeDataSupport(...));
  return tabularDataSupport;

When try I use the MX4J HttpAdaptor to look at the
table data I get

java.lang.ClassCastException
	at
javax.management.openmbean.TabularDataSupport.get(TabularDataSupport.java:25
2)
	at
mx4j.tools.adaptor.http.GetAttributeCommandProcessor.executeRequest(GetAttri
buteCommandProcessor.java:152)
	at
mx4j.tools.adaptor.http.HttpAdaptor$HttpClient.run(HttpAdaptor.java:979)

The object being passed to TabularDataSupport.get() is
a java.util.List and the code is trying to cast it to
Object[]. 

To me it seems that
GetAttributeCommandProcessor.executeRequest() is
confused by the fact that TabularDataSupport implements
the Map interface. There should be some additional case
for TabluarData before checking "if (.. &&
attributeValue instanceof Map)".

My own code seems OK, I can browse the TabularData in
the JDK 1.5 jconsole tool.

----------------------------------------------------------------------

Comment By: Bas de Bakker (basdebakker)
Date: 2004-11-04 15:16

Message:
Logged In: YES 
user_id=1152482

The problem is with the TabularDataSupport implementation. 
In particular, its keySet method returns the keySet of the
dataMap.  This is wrong, because the keys in the dataMap are
instances of List, while the caller correctly expects it to
be instances of Object[].

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=450647&aid=977253&group_id=47745


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.