Again, with the patch this time.

> -----Original Message-----
> From: Jeroen Frijters 
> Sent: Thursday, September 08, 2005 10:33
> To: Classpath-Patches
> Subject: FYI: Serialization implementation for 
> javax/naming/CompoundName.java
> 
> Hi,
> 
> I implemented serialization support for javax.naming.CompoundName.
> 
> Regards,
> Jeroen
> 
> 2005-09-08  Jeroen Frijters  <[EMAIL PROTECTED]>
> 
>         * javax/naming/CompoundName.java
>         (readObject, writeObject): New methods.
> 
Index: javax/naming/CompoundName.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/naming/CompoundName.java,v
retrieving revision 1.9
diff -u -r1.9 CompoundName.java
--- javax/naming/CompoundName.java      2 Jul 2005 20:32:45 -0000       1.9
+++ javax/naming/CompoundName.java      8 Sep 2005 08:16:53 -0000
@@ -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;
@@ -48,9 +51,6 @@
  * @author Tom Tromey ([EMAIL PROTECTED])
  * @date May 16, 2001
  *
- * FIXME: must write readObject and writeObject to conform to
- * serialization spec.
- *
  * FIXME: this class is underspecified.  For instance, the `flat'
  * direction is never described.  If it means that the CompoundName
  * can only have a single element, then the Enumeration-based
@@ -467,6 +467,25 @@
     this.trimBlanks
       = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.trimblanks",
                                               "false")).booleanValue ();
+  }
+
+  private void readObject(ObjectInputStream s)
+    throws IOException, ClassNotFoundException
+  {
+    mySyntax = (Properties) s.readObject();
+    int count = s.readInt();
+    elts = new Vector(count);
+    for (int i = 0; i < count; i++)
+      elts.addElement((String) s.readObject());
+  }
+
+  private void writeObject(ObjectOutputStream s)
+    throws IOException
+  {
+    s.writeObject(mySyntax);
+    s.writeInt(elts.size());
+    for (int i = 0; i < elts.size(); i++)
+        s.writeObject(elts.elementAt(i));
   }
 
   // The spec specifies this but does not document it in any way (it
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to