This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Serialization fixlets from GNU Classpath


Hi,

This merges some serialization fixes discussed on the GNU Classpath
patches list:

2004-11-06  Mattias Rehnberg  <Mattias.Rehnberg@home.se>

        * java/io/Vector.java
        (writeObject): New function to serialized output thread safe.

        * java/io/ObjectOutputStream.java
        (writeObject): Move the assignment of the class handle to after
        the assignment of class descriptor handle.

Committed,

Mark
Index: java/io/ObjectOutputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/ObjectOutputStream.java,v
retrieving revision 1.28
diff -u -r1.28 ObjectOutputStream.java
--- java/io/ObjectOutputStream.java	18 Oct 2004 13:40:05 -0000	1.28
+++ java/io/ObjectOutputStream.java	6 Nov 2004 15:05:35 -0000
@@ -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: java/util/Vector.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/Vector.java,v
retrieving revision 1.16
diff -u -r1.16 Vector.java
--- java/util/Vector.java	23 Apr 2004 06:36:05 -0000	1.16
+++ java/util/Vector.java	6 Nov 2004 15:05:35 -0000
@@ -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,18 @@
     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();
+  }
+
 }

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]