harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r495199 - in /harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/CodeSource.java test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java
Date Thu, 11 Jan 2007 11:34:59 GMT
Author: smishura
Date: Thu Jan 11 03:34:47 2007
New Revision: 495199

URL: http://svn.apache.org/viewvc?view=rev&rev=495199
Log:
Apply modified patch for HARMONY-2787:
[java][security]CodeSource fails to get ObjectStreamField for field "location".

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java?view=diff&rev=495199&r1=495198&r2=495199
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/CodeSource.java
Thu Jan 11 03:34:47 2007
@@ -49,7 +49,7 @@
     private static final long serialVersionUID = 4977541819976013951L;
 
     // Location of this CodeSource object
-    private transient URL location;
+    private URL location;
 
     // Array of certificates assigned to this CodeSource object
     private transient java.security.cert.Certificate[] certs;
@@ -479,7 +479,9 @@
     }
 
     private void writeObject(ObjectOutputStream oos) throws IOException {
-        oos.writeObject(location);
+
+        oos.defaultWriteObject();
+
         if (certs == null || certs.length == 0) {
             oos.writeInt(0);
         } else {
@@ -504,7 +506,9 @@
 
     private void readObject(ObjectInputStream ois) throws IOException,
             ClassNotFoundException {
-        location = (URL) ois.readObject();
+        
+        ois.defaultReadObject();
+        
         int certsCount = ois.readInt();
         certs = null;
         if (certsCount != 0) {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java?view=diff&rev=495199&r1=495198&r2=495199
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/serialization/CodeSourceTest.java
Thu Jan 11 03:34:47 2007
@@ -26,17 +26,19 @@
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.ObjectStreamField;
 import java.net.URL;
-import java.security.CodeSource;
 import java.security.CodeSigner;
+import java.security.CodeSource;
 import java.security.Timestamp;
 import java.security.cert.CertPath;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateEncodingException;
 import java.util.Date;
 
-import org.apache.harmony.testframework.serialization.SerializationTest;
 import org.apache.harmony.security.tests.support.TestCertUtils;
+import org.apache.harmony.testframework.serialization.SerializationTest;
 
 
 /**
@@ -182,5 +184,15 @@
                 new CodeSource(null, x509chain),
         };
         return data;
+    }
+
+    public void testSerilizationDescriptor() throws Exception {
+
+        // Regression for HARMONY-2787
+        ObjectStreamClass objectStreamClass = ObjectStreamClass
+                .lookup(CodeSource.class);
+        ObjectStreamField objectStreamField = objectStreamClass
+                .getField("location");
+        assertEquals("Ljava/net/URL;", objectStreamField.getTypeString());
     }
 }



Mime
View raw message