harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548255 - in /harmony/enhanced/classlib/trunk/modules/jndi/src: main/java/javax/naming/ldap/ test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/ test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/
Date Mon, 18 Jun 2007 08:23:44 GMT
Author: tonywu
Date: Mon Jun 18 01:23:43 2007
New Revision: 548255

URL: http://svn.apache.org/viewvc?view=rev&rev=548255
Log:
Apply patch HARMONY-4206 ([classlib][jndi] Class javax.naming.ldap.Rdn is not serialization
compatible
)

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

Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java?view=diff&rev=548255&r1=548254&r2=548255
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java
Mon Jun 18 01:23:43 2007
@@ -17,6 +17,9 @@
 
 package javax.naming.ldap;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -339,5 +342,25 @@
             }
         }
         return sb.toString();
+    }
+
+    private void readObject(ObjectInputStream ois) throws IOException,
+            ClassNotFoundException, InvalidNameException {
+        ois.defaultReadObject();
+        String rdnString = (String) ois.readObject();
+        if (rdnString == null) {
+            throw new NullPointerException("rdnString "+Messages.getString("ldap.00"));
+        }
+        if (rdnString.length() != 0) {
+            parser = new LdapRdnParser(rdnString);
+            list = parser.getList();
+        } else {
+            list = new ArrayList<Attribute>();
+        }
+    }
+
+    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/RdnTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java?view=diff&rev=548255&r1=548254&r2=548255
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.java
Mon Jun 18 01:23:43 2007
@@ -39,6 +39,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 /**
  * <p>
  * Test cases for all methods of the class Rdn.
@@ -2073,5 +2075,10 @@
             Rdn.unescapeValue("#GOFJMOII");
             fail("Should raise IllegalArgumentException");
         } catch (IllegalArgumentException e) {}
+    }
+
+    public void testSerializationCompatibility() throws Exception{
+        Rdn object = new Rdn("t=\\20\\ te\\ s\\20t\\20\\20 + t2 = test1\\20\\ ");
+        SerializationTest.verifyGolden(this, object);
     }
 }

Added: harmony/enhanced/classlib/trunk/modules/jndi/src/test/resources/serialization/org/apache/harmony/jndi/tests/javax/naming/ldap/RdnTest.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/RdnTest.golden.ser?view=auto&rev=548255
==============================================================================
Binary file - no diff available.

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



Mime
View raw message