Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 1.6.3
    • Component/s: Table
    • Labels:
      None
    • Environment:

      Operating System: Windows 2000
      Platform: All

      Description

      I'm using the lastest stable version of swingX : 0.8.

      I found a bug related to the use of JXTable and Serialization process.

      Here is the code which demonstrates the issue:

      public class JXTableTest extends JXTable{

      public void save(String fileName) {
      FileOutputStream fos = null;
      ObjectOutputStream out = null;
      try {
      fos = new FileOutputStream(fileName + ".ser");
      out = new ObjectOutputStream(fos);
      out.writeObject(this);
      out.close();
      } catch (IOException ex) {
      ex.printStackTrace();
      }
      }

      public static void main(String[] args) {
      JXTableTest table = new JXTableTest();
      table.save("yo");
      }
      }

      The message error is :

      java.io.NotSerializableException: java.beans.EventHandler
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.writeObject(Unknown Source)
      at javax.swing.event.EventListenerList.writeObject(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.writeObject(Unknown Source)
      at javax.swing.ArrayTable.writeArrayTable(Unknown Source)
      at javax.swing.ActionMap.writeObject(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
      at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source)
      at javax.swing.JComponent.writeObject(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)
      at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
      at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
      at java.io.ObjectOutputStream.writeObject0(Unknown Source)
      at java.io.ObjectOutputStream.writeObject(Unknown Source)
      at JXTableTest.save(JXTableTest.java:29)
      at JXTableTest.main(JXTableTest.java:38)

      When you replace "extends JXTable" by "extends JTable", it works!

      Then, serialization doesn't work with JXTable although this class implements
      Serializable.

      I think that an attribute of type eventHandler has not been declared as "transient".

      Regards,

      Adrien

        Issue Links

          Activity

          Hide
          kleopatra added a comment -

          arrgghh... nearly all swingx components are not serializable. Opened a general
          issue 423.

          Show
          kleopatra added a comment - arrgghh... nearly all swingx components are not serializable. Opened a general issue 423.
          Hide
          kleopatra added a comment -
              • Issue 437 has been marked as a duplicate of this issue. ***
          Show
          kleopatra added a comment - Issue 437 has been marked as a duplicate of this issue. ***
          Hide
          kleopatra added a comment -
          Show
          kleopatra added a comment - backlink into forum: http://forums.java.net/jive/thread.jspa?threadID=20638
          Hide
          kleopatra added a comment -


          postponed

          Show
          kleopatra added a comment - postponed
          Hide
          Karl Schaefer added a comment -

          SWINGX-349: Fixed issues preventing the table from serializing. Marked several fields transient for items that we lazily instantiate. AbstractAction's Serializble nature bit us again. Converted instance to UIAction (though I know Jeanette hates that class), since it is free of serialization concerns. The action is class is registered when necessary so not serializing it is not a concern.

          swingx-core/src/main/java/org/jdesktop/swingx/JXTable.java
          swingx-core/src/main/java/org/jdesktop/swingx/JXTableHeader.java
          swingx-core/src/main/java/org/jdesktop/swingx/rollover/RolloverController.java

          Committed revision 3960.

          Show
          Karl Schaefer added a comment - SWINGX-349 : Fixed issues preventing the table from serializing. Marked several fields transient for items that we lazily instantiate. AbstractAction's Serializble nature bit us again. Converted instance to UIAction (though I know Jeanette hates that class), since it is free of serialization concerns. The action is class is registered when necessary so not serializing it is not a concern. swingx-core/src/main/java/org/jdesktop/swingx/JXTable.java swingx-core/src/main/java/org/jdesktop/swingx/JXTableHeader.java swingx-core/src/main/java/org/jdesktop/swingx/rollover/RolloverController.java Committed revision 3960.

            People

            • Assignee:
              Karl Schaefer
              Reporter:
              ledid
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: