On Tuesday 12 September 2006 21:31, Elias Naur wrote:
> Hi,
>
> I've recently stumbled on a problem with serializing arrays from the Sun
> java implementation to the Jikes RVM implementation. I think the problem is
> that Classpath doesn't ignore serialVersionUID mismatches for array
> classes, and since Jikes RVM seems to generate different serials for arrays
> than Sun java a test program like the one attached in my Jikes RVM bug
> report at:
>
> http://sourceforge.net/tracker/index.php?func=detail&aid=1549924&group_id=1
>28805&atid=712768
>
> crashes. It serializes an Object[] with the Sun java and loads in Jikes
> RVM, resulting in an exception. As described in the bug report, the
> Serialization spec was updated to clarify that array serials should be
> ignored when checking for mismatches. I've attached a patch which should
> fix this.
>
> - elias
And here it is inline with a proper ChangeLog entry. I haven't got the
assignment form yet, but since it's a one line change, I assume it can get in
anyway. Please comment.
2006-09-14 Chistian Elias Naur <[EMAIL PROTECTED]>
* java/io/ObjectStreamClass.java (setClass(Class, ObjectStreamClass)):
Added !cl.isArray() to serialVersionUID mismatch check.
Index: java/io/ObjectStreamClass.java
===================================================================
RCS file: /sources/classpath/classpath/java/io/ObjectStreamClass.java,v
retrieving revision 1.46
diff -u -r1.46 ObjectStreamClass.java
--- java/io/ObjectStreamClass.java 21 Aug 2006 09:27:50 -0000 1.46
+++ java/io/ObjectStreamClass.java 12 Sep 2006 19:11:09 -0000
@@ -317,8 +317,8 @@
else
{
// Check that the actual UID of the resolved class matches the UID from
- // the stream.
- if (uid != class_uid)
+ // the stream. Mismatches for array classes are ignored.
+ if (!cl.isArray() && uid != class_uid)
{
String msg = cl +
": Local class not compatible: stream serialVersionUID="