Hi,

I have checked all the classes of the javax.naming subpackages and
found one more serialization problem which is fixed by this patch.

2006-04-06  Wolfgang Baer  <[EMAIL PROTECTED]>

        * javax/naming/CompositeName.java:
        (readObject): New deserialization method.
        (writeObject): New serialization method.

Wolfgang

Index: javax/naming/CompositeName.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/naming/CompositeName.java,v
retrieving revision 1.4
diff -u -r1.4 CompositeName.java
--- javax/naming/CompositeName.java	2 Jul 2005 20:32:45 -0000	1.4
+++ javax/naming/CompositeName.java	6 Apr 2006 17:58:56 -0000
@@ -1,5 +1,5 @@
 /* CompositeName.java --
-   Copyright (C) 2001, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,6 +38,9 @@
 
 package javax.naming;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.Enumeration;
 import java.util.NoSuchElementException;
@@ -45,10 +48,6 @@
 
 /**
  * @author Tom Tromey ([EMAIL PROTECTED])
- * @date May 16, 2001
- *
- * FIXME: must write readObject and writeObject to conform to
- * serialization spec.
  */
 public class CompositeName implements Name, Cloneable, Serializable
 {
@@ -316,6 +315,22 @@
       }
     return result.toString ();
   }
+  
+  private void readObject(ObjectInputStream s) 
+    throws IOException, ClassNotFoundException
+  {
+    int size = s.readInt();
+    elts = new Vector(size);
+    for (int i = 0; i < size; i++)
+      elts.add(s.readObject());
+  }
+
+  private void writeObject(ObjectOutputStream s) throws IOException
+  {
+    s.writeInt(elts.size());
+    for (int i = 0; i < elts.size(); i++)
+      s.writeObject(elts.get(i));
+  }
 
   private transient Vector elts;
 }

Reply via email to