JDK-4498650 : ObjectStreamClass.matchFields failure
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 1.4.0
  • Priority: P1
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-08-31
  • Updated: 2001-08-31
  • Resolved: 2001-08-31
Related Reports
Duplicate :  
Description
jdk 1.4 beta 3, build 78. Netbeans IDE doesn't start correctly anymore with this jdk build, due to this bug. Previous builds (77 and further) worked well, so this seems to be some kind of regression. 

Here is thrown exception, together with debug informations that were put into ObjectStreamClass.matchFields method:  

Comparing isStartup
Local desc idHashCode: 5981330
Comparing tabbedContainerUI
Local desc idHashCode: 5981330
Comparing uiMode
Local desc idHashCode: 5981330
Comparing current
Local desc idHashCode: 5981330
Comparing mainWindowBounds
Local desc idHashCode: 5981330
Comparing oldScreenSize
Local desc idHashCode: 5981330
Comparing workspaces
Local desc idHashCode: 5981330
Comparing mainWindowBounds
Local desc idHashCode: 5981330
Comparing tabbedContainerUI
Local desc idHashCode: 5981330
local field: I tabbedContainerUI
field: Ljava/lang/Integer; tabbedContainerUI
Fri Aug 31 14:26:27 CEST 2001: java.io.InvalidClassException: org.netbeans.core.windows.WindowManagerImpl$SerializationReplacer; incompatible types for field tabbedContainerUI
Annotation: Type= 5, name = Error deserializing window system.
java.io.InvalidClassException: org.netbeans.core.windows.WindowManagerImpl$SerializationReplacer; incompatible types for field tabbedContainerUI
        at java.io.ObjectStreamClass.matchFields(ObjectStreamClass.java:1970)
        at java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:1865)
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:499)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1499)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1413)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1604)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1252)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:323)
        at org.openide.util.io.NbMarshalledObject.get(NbMarshalledObject.java:90)
[catch] at org.netbeans.modules.projects.PSupport.updateWindowManager(PSupport.java:811)
        at org.netbeans.modules.projects.PSupport.projectOpen(PSupport.java:310)
        at org.netbeans.core.NbProjectOperation.setProject(NbProjectOperation.java:129)
        at org.netbeans.core.NbProjectOperation.setOpeningProject(NbProjectOperation.java:185)
        at org.netbeans.core.NbProjectOperation.openOrCreateProject(NbProjectOperation.java:172)
        at org.netbeans.core.NonGui.run(NonGui.java:520)
        at org.netbeans.core.Main.run(Main.java:216)
        at org.openide.TopManager.initializeTopManager(TopManager.java:120)
        at org.openide.TopManager.getDefault(TopManager.java:81)
        at org.netbeans.core.Main.main(Main.java:325)
        at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90)

Exception is saying that class stream descriptor of serialized data and class stream desciptor defined in class WindowManagerImpl.SerializationReplacer are incompatible. However, this shouldn't be true, because data was serialized with exactly the same description of persistent fields.

Reproduction steps:
1) Start the IDE first time, no serialized info exists, all is ok
2) Exit the iDE, data are written to the disk
3) Restart IDE, and during data read you'll get the exception mentioned above.

From looking at the debug prints, I found out that the field "tabbedContainerUI" must change its type somehow, which is strange. I define this field as type Integer.class in WindowManagerImpl.SerializationReplacer. However, debug prints show that it was read from the disk as Integer.TYPE, not Integer.class.
Even more, it looks like field "tabbedContainerUI" was matched twice, first match was succesfull while second failed.

Bad thing is that I'm not able to reproduce described wrong behaviour on some small test. I really don't know why, but only reliable reproduction case is Netbeans IDE itself.