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

[macosx] JSpinner serialiazation - deserialization issue

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b23
    • CPU:
      generic
    • OS:
      os_x

      Description

      http://java.net/jira/browse/MACOSX_PORT-259 submitted 2011/08/10 by Igor Stolyarov
      Issue during JSpinner serialiazation - deserialization.
      Test for reproducing issue:
      import java.io.ByteArrayInputStream;
      import java.io.ByteArrayOutputStream;
      import java.io.ObjectInputStream;
      import java.io.ObjectOutputStream;
      import javax.swing.JSpinner;
      public class JSpinnerSerializeTest {
          public static void main(String[] argv) throws Exception { JSpinner spinner = new JSpinner(); JSpinner firstCopy = (JSpinner) createCopy(spinner); JSpinner secondCopy = (JSpinner) createCopy(firstCopy); }
          private static Object createCopy(java.io.Serializable objectToCopy) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(objectToCopy); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); }
      }
      Test output:
      openjdk version "1.7.0-ea"
      OpenJDK Runtime Environment (build 1.7.0-ea-b202)
      OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)
      Exception in thread "main" java.io.NotSerializableException: com.apple.laf.AquaSpinnerUI
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
      at java.beans.PropertyChangeSupport.writeObject(PropertyChangeSupport.java:451)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:438)
      at java.awt.Component.writeObject(Component.java:8642)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:962)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
      at JSpinnerSerializeTest.createCopy(JSpinnerSerializeTest.java:20)
      at JSpinnerSerializeTest.main(JSpinnerSerializeTest.java:13)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serb Sergey Bylokhov
              Reporter:
              vasya Vassili Igouchkine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: