[kaffe] CVS kaffe (guilhem): Serialization fixes.
Kaffe CVS
cvs-commits at kaffe.org
Wed Nov 3 10:39:26 PST 2004
PatchSet 5396
Date: 2004/11/03 17:45:18
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Serialization fixes.
* libraries/javalib/java/io/Vector.java,
libraries/javalib/java/io/ObjectOutputStream.java:
Resynced with GNU Classpath.
2004-11-02 Mattias Rehnberg <Mattias.Rehnberg at home.se>
* java/io/Vector.java
(readObject, writeObject): New function to match Sun's
serialized output for Vector.
* java/io/ObjectOutputStream.java
(writeObject): Move the assignment of the class handle to after
the assignment of class descriptor handle.
Members:
libraries/clib/io/ObjectInputStream.c:1.5->1.6
libraries/javalib/java/io/ObjectOutputStream.java:1.25->1.26
libraries/javalib/java/util/Vector.java:1.27->1.28
Index: kaffe/libraries/clib/io/ObjectInputStream.c
diff -u kaffe/libraries/clib/io/ObjectInputStream.c:1.5 kaffe/libraries/clib/io/ObjectInputStream.c:1.6
--- kaffe/libraries/clib/io/ObjectInputStream.c:1.5 Mon Oct 25 00:21:06 2004
+++ kaffe/libraries/clib/io/ObjectInputStream.c Wed Nov 3 17:45:18 2004
@@ -86,7 +86,7 @@
static void*
getFieldAddress (struct Hjava_lang_reflect_Field* sfield, struct Hjava_lang_Object *obj)
{
- if (unhand(sfield)->slot < CLASS_NSFIELDS(OBJECT_CLASS(obj))) {
+ if (unhand(sfield)->slot < CLASS_NSFIELDS(OBJECT_CLASS(sfield->clazz))) {
SignalError ("java.lang.IllegalArgumentException", "");
}
Index: kaffe/libraries/javalib/java/io/ObjectOutputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectOutputStream.java:1.25 kaffe/libraries/javalib/java/io/ObjectOutputStream.java:1.26
--- kaffe/libraries/javalib/java/io/ObjectOutputStream.java:1.25 Tue Oct 12 00:07:48 2004
+++ kaffe/libraries/javalib/java/io/ObjectOutputStream.java Wed Nov 3 17:45:16 2004
@@ -220,7 +220,6 @@
{
Class cl = (Class)obj;
ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(cl);
- assignNewHandle(obj);
realOutput.writeByte(TC_CLASS);
if (!osc.isProxyClass)
{
@@ -241,6 +240,7 @@
writeObject(osc.getSuper());
}
+ assignNewHandle(obj);
break;
}
Index: kaffe/libraries/javalib/java/util/Vector.java
diff -u kaffe/libraries/javalib/java/util/Vector.java:1.27 kaffe/libraries/javalib/java/util/Vector.java:1.28
--- kaffe/libraries/javalib/java/util/Vector.java:1.27 Thu Apr 22 11:40:44 2004
+++ kaffe/libraries/javalib/java/util/Vector.java Wed Nov 3 17:45:17 2004
@@ -37,6 +37,9 @@
package java.util;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Array;
@@ -912,4 +915,32 @@
if (index >= elementCount)
throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
}
+
+ /**
+ * Serializes this object to the given stream.
+ *
+ * @param s the stream to write to
+ * @throws IOException if the underlying stream fails
+ * @serialData just calls default write function
+ */
+ private synchronized void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.defaultWriteObject();
+ }
+
+ /**
+ * Deserializes this object from the given stream.
+ *
+ * @param s the stream to read from
+ * @throws ClassNotFoundException if the underlying stream fails
+ * @throws IOException if the underlying stream fails
+ * @serialData just calls default read function
+ */
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ }
+
}
More information about the kaffe
mailing list