Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4165217

JColorChooser is not serialized

XMLWordPrintable

    • tiger
    • x86
    • windows_nt

      JDK1.2FCS-E:

      Please run attached code to reproduce:

      java.io.NotSerializableException: com.sun.java.swing.ToolTipManager
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.util.Hashtable.writeObject(Compiled Code)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.util.Hashtable.writeObject(Compiled Code)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at com.sun.java.swing.JComponent.writeObject(JComponent.java:3708)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputArray(Compiled Code)
              at java.io.ObjectOutputStream.checkSubstitutableSpecialClasses(Compiled
      Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
              at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
              at java.awt.Container.writeObject(Container.java:1465)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.io.ObjectOutputStream.invokeObjectWriter(ObjectOutputStream.java
      :1577)
              at java.io.ObjectOutputStream.outputObject(Compiled Code)
              at java.io.ObjectOutputStream.writeObject(Compiled Code)
              at SerialTest.test(SerialTest.java:60)
              at SerialTest.main(SerialTest.java:48)
      (fail): 1
      bae-chul.kim@eng 1998-08-10
      =======================================

      Here is an update to this bug. There seems to be a different exception from the ones listed. It would be nice to have this fixed. Here's the sample program to reproduce the bug.

      -------------------------------- Cut Here ---------------------------------
      import javax.swing.*;
      import java.io.*;

      public class TestSerialize {

          private JColorChooser chooser;

          public static void main(String[] args) {
              new TestSerialize();
          }

          public TestSerialize() {
              chooser = new JColorChooser();

              try {
                  serializeAndDeserialize(chooser);
              } catch(Exception e) {
                  e.printStackTrace();
              }
          }

          private Object serializeAndDeserialize(Object toWrite)
              throws ClassNotFoundException, IOException {

              FileOutputStream fos = new FileOutputStream("cereal.dat");
              ObjectOutputStream oos = new ObjectOutputStream(fos);
              oos.writeObject(toWrite);
              oos.flush();
              fos.close();

              FileInputStream fis = new FileInputStream(System.getProperty
                  ("resultsdir") +
                  File.separator + "cereal.dat");
              ObjectInputStream ois = new ObjectInputStream(fis);
              Object retVal = ois.readObject();
              fis.close();

              return retVal;
          }
      }
      -------------------------------- Cut Here ---------------------------------

      java.io.NotSerializableException: javax.swing.colorchooser.DefaultHSBChooserPanel$HueImage
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1057)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1333)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1305)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1248)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1055)
              at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1227)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1053)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1333)
              at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:370)
              at java.awt.Container.writeObject(Container.java:2536)
              at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:28)
              at java.lang.reflect.Method.invoke(Method.java:327)
              at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:783)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1297)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1248)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1055)
              at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1227)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1053)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1333)
              at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:370)
              at java.awt.Container.writeObject(Container.java:2536)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:28)
              at java.lang.reflect.Method.invoke(Method.java:327)
              at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:783)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1297)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1248)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1055)
              at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1227)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1053)
              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1333)
              at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:370)
              at java.awt.Container.writeObject(Container.java:2536)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:28)
              at java.lang.reflect.Method.invoke(Method.java:327)
              at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:783)
              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1297)
              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1248)
              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1055)
              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:281)
              at TestSerialize.serializeAndDeserialize(TestSerialize.java:27)
              at TestSerialize.<init>(TestSerialize.java:16)
              at TestSerialize.main(TestSerialize.java:9)


      ###@###.### 2001-11-15
      ============================================

            duke J. Duke
            bkimsunw Bae-chul Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: