• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't deserialize in Java 6

 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On one computer (with Java 6) I was working on a file, then I saved it (serialized it) and then transferred it to another computer with Java 1.4. I had no problem opening the file and serializing it again in Java 1.4. But then I transferred it to the Java 6 computer and tried to open it, I got this message:
java.io.StreamCorruptedException: invalid handle value: 005E39C7
at java.io.ObjectInputStream.readHandle(Unknown Source)
and some other Exception detail lines which include
at java.util.TreeMap.buildFromSorted(Unknown Source)

The object I want to read is of a class which is compiled by code which I wrote. That class contains TreeMap objects which are to be serialized as part of the object. What I think is that somehow TreeMap in java 1.4 differs from TreeMap in java 6.
I would expect java 1.4 not to be able to open an object serialized by java 6, but I did not expect that java 6 could not open an object serialized by java 1.4.

I don't know if this makes any difference, but the .class files were created this way: I have some text files *.java and I compiled the files twice, once on each of the two computers.

Help!
 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I know what the problem was. I went back to the computer with java 1.4 on it and tried opening both the file saved on that computer, and the file which was copied over to the flash memory. The file saved on the computer opened fine, but the file on the flash memory gave the same Exception message. So I think the file became corrupted when transferred to the flash memory. So it's not a problem with java.
Never mind!
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's more likely to be a version problem - serialization using object streams generally doesn't work if two different JRE versions are involved at the two ends.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic