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

Objects serialized on 1.5 cannot be deserialized on 1.6

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0_09"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
      Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode, sharing)
      and
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Slackware Linux 11.0 with 2.4 kernel

      A DESCRIPTION OF THE PROBLEM :
      My program retains some of its data by serializing a vector that contains objects that inherit from JLabel. The JLabel subclass explicity states a static final long serialVersionUID = 4326184629916070393L;

      Data created under 1.5, cannot be loaded by 1.6 and vice versa; otherwise behaviour is as expected. There was no problem moving from 1.4.2 to 1.5 and across OSs to a Windows 2000 / XP, JVM 1.4.2 / 1.5.

      Attempting to load the data throws a java.io.InvalidClassException


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You could download the source code of my program from http://pooter.sourceforge.net
      or a binary version compiled under 1.5.

      Use the ThoughtMap module to create and save a thought map under a 1.5 JVM, then run the program under a 1.6 JVM

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The serialized data should load whatever JVM is used to run the program
      ACTUAL -
      Data created on 1.5 will not load on 1.6; recompiling the code under 1.6 has no effect.

      The program otherwise runs as well or better on 1.6, but data created is not loadable if one reverts to 1.5.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.io.InvalidClassException: javax.swing.JComponent; local class incompatible: stream classdesc serialVersionUID = -2514362798440941654, local class serialVersionUID = 7917968344860800289

      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
              at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
              at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
              at pooter.notes.ThoughtMap.readData(ThoughtMap.java:713)
              at pooter.notes.MapFileChooser$2.actionPerformed(MapFileChooser.java:100)
              at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
              at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
              at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
              at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
              at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
              at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
              at java.awt.Component.processMouseEvent(Component.java:5488)
              at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
              at java.awt.Component.processEvent(Component.java:5253)
              at java.awt.Container.processEvent(Container.java:1966)
              at java.awt.Component.dispatchEventImpl(Component.java:3955)
              at java.awt.Container.dispatchEventImpl(Container.java:2024)
              at java.awt.Component.dispatchEvent(Component.java:3803)
              at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
              at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
              at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
              at java.awt.Container.dispatchEventImpl(Container.java:2010)
              at java.awt.Window.dispatchEventImpl(Window.java:1778)
              at java.awt.Component.dispatchEvent(Component.java:3803)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
              at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
              at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Its not practical for me to do this.

      Please refer to the ThoughtMap and Node classes of my application. Node is the extended JLabel, instances of which are placed in a Vector (nodeStore) that's instatiated in ThoughtMap. ThoughtMap also contains the code that serializes and reconstitutes the Vector.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None known; I posted a request for help on several Java sites, the only feedback I have says this is a bug, not a fault of my code, but an incompatability of JComponent between the two versions

        Attachments

          Activity

            People

            • Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: