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: 6655515
Votes 12
Synopsis MBeans tab: operation return values of type Component displayed as String
Category java:jconsole
Reported Against
Release Fixed 7(b25), 6u10(b13) (Bug ID:2159452)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 25-JAN-2008
Description
Operation return values of type java.awt.Component are displayed as java.lan.String
instead of being displayed as AWT/Swing components in a container.

This is a regression introduced in JConsole 6/7.
Posted Date : 2008-01-25 23:10:43.0
Work Around
N/A
Evaluation
Do not convert Components to Strings.
Posted Date : 2008-01-25 23:12:24.0

I was able to build JConsole using the instructions at <http://nb-openjdk.netbeans.org/get-and-build-jconsole.html> and apply the following fix:

diff -r 93cc3fad6803 src/share/classes/sun/tools/jconsole/inspector/XDataViewer.java
--- a/src/share/classes/sun/tools/jconsole/inspector/XDataViewer.java	Tue Jan 15 13:35:38 2008 +0100
+++ b/src/share/classes/sun/tools/jconsole/inspector/XDataViewer.java	Tue Feb 05 18:17:00 2008 +0100
@@ -108,6 +108,7 @@ public class XDataViewer {
     public Component createOperationViewer(Object value,
                                            XMBean mbean) {
         if(value instanceof Number) return null;
+        if(value instanceof Component) return (Component) value;
         return createAttributeViewer(value, mbean, null, null);
     }
 
So people for whom this is a blocking problem can always install a custom JConsole with this fix.

Having said that, it's not clear that it's a good idea for MBean operations to return Swing components.  Swing serialization is explicitly stated not to be compatible across releases, so this will only work if your JConsole is running on the same JDK as your application.  Furthermore you have to be extremely careful that your component does not reference any application-specific classes.  For example, tables created in the usual way are editable, and if you want to make one non-editable then the usual way to do that is to create a subclass of DefaultTableModel that overrides isCellEditable.  But if you do that then JConsole won't know your subclass and will fail mysteriously when it tries to read the result of your operation.

But it is true that this is a convenient if dangerous way to provide formatted data to human users, and it is very simple to modify JConsole to support it.  Given that the JDK 5.0 version did support it we should update JDK 6 to support it too.
Posted Date : 2008-02-05 17:23:59.0
Comments
  
  Include a link with my name & email   

Submitted On 29-JAN-2008
ramkiFromCity
got to be fixed soon.


Submitted On 01-FEB-2008
ramkiFromCity
Could you please fix this as we have implemented quite a lot of JMX using the above feature in JDK 1.5 and now we have to move to JDK 1.6 for 64 bit support. Cause of this bug we are having to find alternative ways to implement it and it isnt cost effective for us.


Submitted On 11-FEB-2008
ramkiFromCity
Hi, We are very much aware of the Swing Components Serial Version changes with JDK releases. It is not a big concern for us. And we just use the JConsole to display the data in a more readable format in a light weight way than just simple text messages and hence other dangers posted is not a concern for us too. 



PLEASE NOTE: JDK6 is formerly known as Project Mustang