-
Bug
-
Resolution: Won't Fix
-
P3
-
None
-
6, 6u23
-
generic, x86
-
generic, windows_xp
After serializing an object on 1.6 with the code (WriteTest.java, attached), deserializing the object with the code (ReadTest.java, also attached) on the prior releases (say 1.4.1) will throw the following exception:
java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1301)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at ReadTest.<init>(ReadTest.java:13)
at ReadTest.main(ReadTest.java:6)
According to the serialization specification, adding a field is a compatible change:
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6519
That the new field uses a class that's not known to an old JRE, RoundingMode in this case, shouldn't matter because deserialization should just skip over the data for the unknown field.
###@###.### 2005-03-14 19:14:33 GMT
###@###.### 2005-03-14 19:16:54 GMT
java.io.StreamCorruptedException
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1301)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at ReadTest.<init>(ReadTest.java:13)
at ReadTest.main(ReadTest.java:6)
According to the serialization specification, adding a field is a compatible change:
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6519
That the new field uses a class that's not known to an old JRE, RoundingMode in this case, shouldn't matter because deserialization should just skip over the data for the unknown field.
###@###.### 2005-03-14 19:14:33 GMT
###@###.### 2005-03-14 19:16:54 GMT
- duplicates
-
JDK-6520085 DecimalFormat cannot be deserialized in 1.3.1 when serialized with Java 6
-
- Closed
-
-
JDK-7004748 Serialization problem(StreamCorrupedException) in java.math.RoundingMode between 1.4.2 and 6
-
- Closed
-