harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r540862 - in /harmony/enhanced/classlib/trunk/modules/jndi: ./ src/main/java/javax/naming/ldap/ src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ src/test/resources/serialization/org/ src/test/resources/serialization/org/apache...
Date Wed, 23 May 2007 06:59:19 GMT
Author: pyang
Date: Tue May 22 23:59:17 2007
New Revision: 540862

URL: http://svn.apache.org/viewvc?view=rev&rev=540862
Log:
Apply patch for HARMONY-3882([classlib][jndi] Class LdapName is not serialization compatible)

Added:
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.golden.ser
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/jndi/build.xml
    harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
    harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java

Modified: harmony/enhanced/classlib/trunk/modules/jndi/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/build.xml?view=diff&rev=540862&r1=540861&r2=540862
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/build.xml (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/build.xml Tue May 22 23:59:17 2007
@@ -140,6 +140,7 @@
                 </fileset>
             </bootclasspath>
             <classpath location="../../build/tests" />
+            <classpath location="../../deploy/build/test/support.jar" />
         </javac>
     </target>
 
@@ -167,6 +168,9 @@
 
             <classpath>
                 <pathelement path="${hy.jndi.bin.test}"/>
+                <fileset dir="${hy.hdk}/build/test/">
+                    <include name="*.jar" />
+                </fileset>
             </classpath>
             <classpath location="../../build/tests" />
 

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java?view=diff&rev=540862&r1=540861&r2=540862
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
Tue May 22 23:59:17 2007
@@ -17,7 +17,9 @@
 
 package javax.naming.ldap;
 
-import javax.naming.ldap.Rdn;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -39,7 +41,7 @@
 
     private static final long serialVersionUID = -1595520034788997356L;
 
-    private List<Rdn> rdns;
+    private transient List<Rdn> rdns;
 
     /**
      * @ar.org.fitc.spec_ref
@@ -379,5 +381,17 @@
             sb.append(rdns.get(i).toString());
         }
         return sb.toString();
+    }
+    
+    private void readObject(ObjectInputStream ois) throws IOException,
+            ClassNotFoundException, InvalidNameException {
+        ois.defaultReadObject();
+        LdapNameParser parser = new LdapNameParser((String) ois.readObject());
+        this.rdns = parser.getList();
+    }
+
+    private void writeObject(ObjectOutputStream oos) throws IOException {
+        oos.defaultWriteObject();
+        oos.writeObject(this.toString());
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java?view=diff&rev=540862&r1=540861&r2=540862
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.java
Tue May 22 23:59:17 2007
@@ -33,6 +33,7 @@
 import javax.naming.ldap.Rdn;
 
 import junit.framework.TestCase;
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 /**
  * 
@@ -3641,5 +3642,11 @@
         LdapName ln2 = new LdapName(
                 "t=test1+f=anything,d=here;j=uos<asd,h=that,");
         assertTrue(ln.compareTo(ln2) == 0);
+    }
+
+    public void testSerializationCompatibility() throws Exception{
+        LdapName object = new LdapName("t=test\\, , t1=\\ test1");
+        object.add(new Rdn("t2=te\\ st2"));
+        SerializationTest.verifyGolden(this, object);
     }
 }

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.golden.ser
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.golden.ser?view=auto&rev=540862
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/LdapNameTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message