Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6610174
Votes 0
Synopsis Improve CompositeDataSupport.toString when it includes arrays
Category jmx:classes
Reported Against
Release Fixed 7(b34)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs
Submit Date 27-SEP-2007
Description
The toString of CompositeDataSupport has two defects that make it hard to read:
* It includes the complete CompositeType, displayed verbosely
* If the contents include an array, it is displayed with the useless default Object.toString.

This means that naive uses such as log files, debug messages, simple HTML adaptors and so on are less readable than they might be. A typical toString might look like this:

[javax.management.openmbean.CompositeDataSupport(compositeType=javax.management.openmbean.CompositeType(name=com.sun.hss.domain.types.CapabilitiesMap,items=((itemName=empty,itemType=javax.management.openmbean.SimpleType(name=java.lang.Boolean)),(itemName=entries,itemType=javax.management.openmbean.ArrayType(name=[Ljavax.management.openmbean.CompositeData;,dimension=1,elementType=javax.management.openmbean.CompositeType(name=com.sun.hss.domain.types.CapabilitiesMap$CapEntry,items=((itemName=key,itemType=javax.management.openmbean.SimpleType(name=java.lang.String)),(itemName=value,itemType=javax.management.openmbean.SimpleType(name=java.lang.Integer)))),primitiveArray=false)))),contents={empty=false, entries=[Ljavax.management.openmbean.CompositeData;@1e8697e})]

There is almost no useful information there.
Posted Date : 2007-09-27 07:49:19.0
Work Around
N/A
Evaluation
It is unlikely that any existing code is relying on the exact format of this toString(), and we do not in general guarantee that toString() will be parseable.  So there should not be a compatibility problem with this change.  At least we should display contained arrays with Arrays.deepToString; probably also we could abbreviate or even omit the contained CompositeType.

We should visit TabularDataSupport.toString at the same time.
Posted Date : 2007-09-27 07:49:19.0

In fact CompositeDataSupport.toString() is fairly completely specified, which was probably a mistake but makes it harder to argue that we can change the string format with impunity.  Perhaps we could add a toShortString() method with a shorter and nicer format, but for the purposes of this CR, I believe we should just fix the way arrays are handled inside the existing toString().
Posted Date : 2008-08-08 15:53:28.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang