2004-11-06 Mattias Rehnberg <Mattias.Rehnberg@home.se>
authorMattias Rehnberg <Mattias.Rehnberg@home.se>
Sat, 6 Nov 2004 15:52:00 +0000 (16:52 +0100)
committerMark Wielaard <mark@gcc.gnu.org>
Sat, 6 Nov 2004 15:52:00 +0000 (15:52 +0000)
        * 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.

From-SVN: r90175

libjava/ChangeLog
libjava/java/io/ObjectOutputStream.java
libjava/java/util/Vector.java

index 29ea613d00656ede44531d55ee7c1a5f5ee91b1f..06fb5bd1df5805fc28e3bad401384b6a66afbba4 100644 (file)
@@ -1,3 +1,12 @@
+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.
+
 2004-11-06  Robert Schuster <thebohemian@gmx.net>
 
        Fixes documentation and indentation
index f66cddd62de2d95ac8104a14bd9e57495699660f..cef8a274266fd469098b3d8a790582c50e143cd2 100644 (file)
@@ -220,7 +220,6 @@ public class ObjectOutputStream extends OutputStream
              {
                Class cl = (Class)obj;
                ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(cl);
-               assignNewHandle(obj);
                realOutput.writeByte(TC_CLASS);
                if (!osc.isProxyClass)
                  {
@@ -241,6 +240,7 @@ public class ObjectOutputStream extends OutputStream
                    
                    writeObject(osc.getSuper());
                  }
+               assignNewHandle(obj);
                break;
              }
 
index d72788e3018783f17dcd0bc924f8d412323898d3..edc14a4e99a5ee906bbc730d83e01c1c2785b210 100644 (file)
@@ -37,6 +37,9 @@ exception statement from your version. */
 
 
 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 @@ public class Vector extends AbstractList
     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();
+  }
+
 }