harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r541025 - in /harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/java/security/ main/java/common/java/security/cert/ main/java/common/org/apache/harmony/security/asn1/ main/java/common/org/apache/harmony/security/fortres...
Date Wed, 23 May 2007 18:48:41 GMT
Author: ayza
Date: Wed May 23 11:48:39 2007
New Revision: 541025

URL: http://svn.apache.org/viewvc?view=rev&rev=541025
Log:
Applying slightly updated version of the patch for HARMONY-3015 ([classlib][security] Fixes for some minor bugs in the security module found by FindBugs)

Modified:
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Permissions.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Timestamp.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CollectionCertStoreParameters.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/LDAPCertStoreParameters.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CertSelector.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/InformationObjectSet.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImpl.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertPathImpl.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPrivateKeyImpl.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPublicKeyImpl.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValueComparator.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/Name.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralName.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java
    harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/tsp/PKIStatusInfo.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java
    harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java Wed May 23 11:48:39 2007
@@ -79,7 +79,7 @@
                 permission));
         } else { 
             // this is the first element provided that another thread did not add
-            synchronized (items) {
+            synchronized (this) {
                 if (permClass != null && inClass != permClass) {
                     throw new IllegalArgumentException(Messages.getString("security.16", //$NON-NLS-1$
                         permission));
@@ -178,7 +178,7 @@
         ObjectInputStream.GetField fields = in.readFields();
 
         items = new HashMap<String, Permission>();
-        synchronized (items) {
+        synchronized (this) {
             permClass = (Class<? extends Permission>)fields.get("permClass", null); //$NON-NLS-1$
             items.putAll((Hashtable<String, Permission>) fields.get(
                     "permissions", new Hashtable<String, Permission>())); //$NON-NLS-1$

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/KeyStore.java Wed May 23 11:48:39 2007
@@ -729,7 +729,7 @@
          * 
          * @author Vera Petrashkova
          */
-        private class TmpLSParameter implements LoadStoreParameter {
+        private static class TmpLSParameter implements LoadStoreParameter {
 
             // Store used protection parameter
             private final ProtectionParameter protPar;
@@ -819,7 +819,9 @@
          *  
          */
         public PasswordProtection(char[] password) {
-            this.password = password;
+        	if (password != null) {
+        		this.password = password.clone();
+        	}
         }
 
         /**
@@ -922,7 +924,7 @@
          *  
          */
         public Certificate[] getCertificateChain() {
-            return chain;
+            return chain.clone();
         }
 
         /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Permissions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Permissions.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Permissions.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Permissions.java Wed May 23 11:48:39 2007
@@ -234,9 +234,10 @@
         Map perms = (Map)fields.get("perms", null); //$NON-NLS-1$
         klasses = new HashMap();
         synchronized (klasses) {
-            for (Iterator iter = perms.keySet().iterator(); iter.hasNext();) {
-                Class key = (Class)iter.next();
-                PermissionCollection pc = (PermissionCollection)perms.get(key);
+            for (Iterator iter = perms.entrySet().iterator(); iter.hasNext();) {
+                Map.Entry entry = (Map.Entry)  iter.next();
+                Class key = (Class) entry.getKey();
+                PermissionCollection pc = (PermissionCollection) entry.getValue();
                 if (key != pc.elements().nextElement().getClass()) {
                     throw new InvalidObjectException(Messages.getString("security.22")); //$NON-NLS-1$
                 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Provider.java Wed May 23 11:48:39 2007
@@ -24,6 +24,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.NotActiveException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -294,14 +295,14 @@
             alg = getPropertyIgnoreCase("Alg.Alias." + servAlg); //$NON-NLS-1$
             if (alg != null) {
                 servAlg = serv + "." + alg; //$NON-NLS-1$
-                prop = getPropertyIgnoreCase(serv + "." + alg); //$NON-NLS-1$
+                prop = getPropertyIgnoreCase(servAlg); //$NON-NLS-1$
             }
         }
         if (prop != null) {
             if (attribute == null) {
                 return true;
             } else {
-                return checkAttribute(serv + "." + alg, attribute, val); //$NON-NLS-1$
+                return checkAttribute(servAlg, attribute, val); //$NON-NLS-1$
             }
         }
         return false;
@@ -889,5 +890,11 @@
             }
             return result;
         }
+    }
+    
+    private void readObject(java.io.ObjectInputStream in) throws NotActiveException, IOException, ClassNotFoundException {
+    	in.defaultReadObject();
+        versionString = String.valueOf(version);
+        providerNumber = -1;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Timestamp.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Timestamp.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Timestamp.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/Timestamp.java Wed May 23 11:48:39 2007
@@ -87,7 +87,7 @@
      * @com.intel.drl.spec_ref 
      */
     public Date getTimestamp() {
-        return timestamp;
+        return (Date) timestamp.clone();
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/UnresolvedPermissionCollection.java Wed May 23 11:48:39 2007
@@ -161,9 +161,10 @@
      */
     private void writeObject(java.io.ObjectOutputStream out) throws IOException {
         Hashtable permissions = new Hashtable();
-        for (Iterator iter = klasses.keySet().iterator(); iter.hasNext();) {
-            String key = (String)iter.next();
-            permissions.put(key, new Vector(((Collection)klasses.get(key))));
+        for (Iterator iter = klasses.entrySet().iterator(); iter.hasNext();) {
+        	Map.Entry entry = (Map.Entry) iter.next();
+            String key = (String) entry.getKey();
+            permissions.put(key, new Vector(((Collection) entry.getValue())));
         }
         ObjectOutputStream.PutField fields = out.putFields();
         fields.put("permissions", permissions); //$NON-NLS-1$
@@ -181,20 +182,23 @@
         Map permissions = (Map)fields.get("permissions", null); //$NON-NLS-1$
         klasses = new HashMap();
         synchronized (klasses) {
-            for (Iterator iter = permissions.keySet().iterator(); iter
-                .hasNext();) {
-                String key = (String)iter.next();
-                Collection values = (Collection)permissions.get(key);
-                for (Iterator iterator = values.iterator(); iterator.hasNext();) {
-                    UnresolvedPermission element = (UnresolvedPermission)iterator
-                        .next();
-                    if (!element.getName().equals(key)) {
-                        throw new InvalidObjectException(
-                            Messages.getString("security.22")); //$NON-NLS-1$
-                    }
-                }
-                klasses.put(key, new HashSet(values));
-            }
+            for (Iterator iter = permissions.entrySet().iterator(); iter
+            	.hasNext();) {
+            	Map.Entry entry = (Map.Entry) iter.next();
+	            String key = (String) entry.getKey();
+	            Collection values = (Collection) entry.getValue();
+
+	            for (Iterator iterator = values.iterator(); iterator.hasNext();) {
+	                UnresolvedPermission element =
+	                        (UnresolvedPermission) iterator.next();
+
+	                if (!element.getName().equals(key)) {
+	                    throw new InvalidObjectException(
+	                        Messages.getString("security.22")); //$NON-NLS-1$
+	                }
+	            }
+	            klasses.put(key, new HashSet(values));
+	        }
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CollectionCertStoreParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CollectionCertStoreParameters.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CollectionCertStoreParameters.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/CollectionCertStoreParameters.java Wed May 23 11:48:39 2007
@@ -59,7 +59,11 @@
      * @com.intel.drl.spec_ref
      */
     public Object clone() {
-        return new CollectionCertStoreParameters(collection);
+        try {
+			return super.clone();
+		} catch (CloneNotSupportedException e) {
+			return null;
+		}
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/LDAPCertStoreParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/LDAPCertStoreParameters.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/LDAPCertStoreParameters.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/LDAPCertStoreParameters.java Wed May 23 11:48:39 2007
@@ -71,7 +71,11 @@
      * @com.intel.drl.spec_ref
      */
     public Object clone() {
-        return new LDAPCertStoreParameters(serverName, port);
+    	try {
+			return super.clone();
+		} catch (CloneNotSupportedException e) {
+			return null;
+		}
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CRLSelector.java Wed May 23 11:48:39 2007
@@ -337,14 +337,16 @@
      * @com.intel.drl.spec_ref
      */
     public Object clone() {
-        X509CRLSelector result = new X509CRLSelector();
-        if (issuerNames != null) {
-            result.issuerNames = new ArrayList<String>(issuerNames);
-        }
-        result.minCRL = minCRL;
-        result.maxCRL = maxCRL;
-        result.dateAndTime = dateAndTime;
-        result.certificateChecking = certificateChecking;
+        X509CRLSelector result;
+
+		try {
+			result = (X509CRLSelector) super.clone();
+			if (issuerNames != null) {
+	            result.issuerNames = new ArrayList<String>(issuerNames);
+	        }
+		} catch (CloneNotSupportedException e) {
+			result = null;
+		}        
         return result;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CertSelector.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CertSelector.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CertSelector.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/java/security/cert/X509CertSelector.java Wed May 23 11:48:39 2007
@@ -1052,11 +1052,14 @@
      * @com.intel.drl.spec_ref
      */
     public Object clone() {
-        X509CertSelector result = new X509CertSelector();
-        result.certificateEquals = this.certificateEquals;
-        result.serialNumber = this.serialNumber;
-        result.issuer = this.issuer;
-        result.subject = this.subject;
+        X509CertSelector result;
+
+		try {
+			result = (X509CertSelector) super.clone();
+		} catch (CloneNotSupportedException e) {
+			return null;
+		}
+
         if (this.subjectKeyIdentifier != null) {
             result.subjectKeyIdentifier =
                 new byte[this.subjectKeyIdentifier.length];
@@ -1071,9 +1074,6 @@
                     result.authorityKeyIdentifier, 0,
                     this.authorityKeyIdentifier.length);
         }
-        result.certificateValid = this.certificateValid;
-        result.subjectPublicKeyAlgID = this.subjectPublicKeyAlgID;
-        result.privateKeyValid = this.privateKeyValid;
         if (this.subjectPublicKey != null) {
             result.subjectPublicKey = new byte[this.subjectPublicKey.length];
             System.arraycopy(this.subjectPublicKey, 0, result.subjectPublicKey,
@@ -1087,8 +1087,6 @@
         result.extendedKeyUsage = (this.extendedKeyUsage == null)
             ? null
             : new HashSet(this.extendedKeyUsage);
-        result.matchAllNames = this.matchAllNames;
-        result.pathLen = this.pathLen;
         if (this.subjectAltNames != null) {
             result.subjectAltNames = new ArrayList[9];
             for (int i=0; i<9; i++) {
@@ -1098,15 +1096,12 @@
                 }
             }
         }
-        result.nameConstraints = this.nameConstraints;
         result.policies = (this.policies == null)
             ? null
             : new HashSet(this.policies);
         result.pathToNames = (this.pathToNames == null)
             ? null
             : new ArrayList(this.pathToNames);
-        result.subjectPublicKeyImpl = this.subjectPublicKeyImpl;
-
         return result;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/ASN1Choice.java Wed May 23 11:48:39 2007
@@ -25,6 +25,7 @@
 import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.harmony.security.internal.nls.Messages;
@@ -269,12 +270,14 @@
         // fill identifiers array
         int size = map.size();
         identifiers = new int[2][size];
-        Iterator it = map.keySet().iterator();
+        Iterator it = map.entrySet().iterator();
+
         for (int i = 0; i < size; i++) {
-            BigInteger identifier = (BigInteger) it.next();
+        	Map.Entry entry = (Map.Entry) it.next();
+            BigInteger identifier = (BigInteger) entry.getKey();
 
             identifiers[0][i] = identifier.intValue();
-            identifiers[1][i] = ((BigInteger) map.get(identifier)).intValue();
+            identifiers[1][i] = ((BigInteger) entry.getValue()).intValue();
         }
 
         this.type = type;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/InformationObjectSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/InformationObjectSet.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/InformationObjectSet.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/InformationObjectSet.java Wed May 23 11:48:39 2007
@@ -95,7 +95,7 @@
         return intHash & 0x7FFFFFFF; // only positive
     }
 
-    private class Entry {
+    private static class Entry {
         public int[] oid;
 
         public Object object;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicy.java Wed May 23 11:48:39 2007
@@ -163,7 +163,7 @@
 
     // A flag indicating brand new instance which needs to be loaded
     // on the first appeal to it's data.
-    private boolean initiailized;
+    private boolean initialized;
 
     /**
      * Default constructor, equivalent to
@@ -180,7 +180,7 @@
      */
     public DefaultPolicy(DefaultPolicyParser dpr) {
         parser = dpr;
-        initiailized = false;
+        initialized = false;
         refresh();
     }
 
@@ -191,9 +191,9 @@
      * to be <code>null</code> if the domain is <code>null</code>.
      */
     public PermissionCollection getPermissions(ProtectionDomain pd) {
-        if (!initiailized) {
+        if (!initialized) {
             synchronized (this) {
-                if (!initiailized) {
+                if (!initialized) {
                     refresh();
                 }
             }
@@ -230,9 +230,9 @@
      * The evaluation assumes that current principals are undefined.
      */
     public PermissionCollection getPermissions(CodeSource cs) {
-        if (!initiailized) {
+        if (!initialized) {
             synchronized (this) {
-                if (!initiailized) {
+                if (!initialized) {
                     refresh();
                 }
             }
@@ -306,6 +306,6 @@
 
             cache.clear();
         }
-        initiailized = true;
+        initialized = true;
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/fortress/Services.java Wed May 23 11:48:39 2007
@@ -52,7 +52,7 @@
     /**
      * Refresh number
      */
-    public static int refreshNumber = 1;
+    static int refreshNumber = 1;
 
     // Registered providers
     private static final List<Provider> providers = new ArrayList<Provider>(20);
@@ -85,8 +85,10 @@
                 providers.add(p);
                 providersNames.put(p.getName(), p);
                 initServiceInfo(p);
-            } catch (Exception e) { // ignore
-            }
+            } catch (ClassNotFoundException e) { // ignore Exceptions
+            } catch (IllegalAccessException e) {
+			} catch (InstantiationException e) {
+			}
         }
         Engine.door.renumProviders();
     }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImpl.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertFactoryImpl.java Wed May 23 11:48:39 2007
@@ -515,9 +515,7 @@
                 if (boundary_suffix[i] != inStream.read()) {
                     throw new IOException(
                         Messages.getString("security.15B", //$NON-NLS-1$
-                            ((boundary_suffix == null) 
-                                ? "" 
-                                : new String(boundary_suffix)))); //$NON-NLS-1$
+                            new String(boundary_suffix))); //$NON-NLS-1$
                 }
             }
             // read new line characters
@@ -574,9 +572,7 @@
                 if (boundary_suffix[i] != inStream.read()) {
                     throw new IOException(
                         Messages.getString("security.15B1", //$NON-NLS-1$
-                            ((boundary_suffix == null) 
-                                ? "" 
-                                : new String(boundary_suffix)))); //$NON-NLS-1$
+                            new String(boundary_suffix))); //$NON-NLS-1$
                 }
             }
         }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertPathImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertPathImpl.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertPathImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CertPathImpl.java Wed May 23 11:48:39 2007
@@ -313,7 +313,7 @@
     /**
      * ASN.1 DER Encoder/Decoder for PkiPath structure.
      */
-    public static ASN1SequenceOf ASN1 =
+    public static final ASN1SequenceOf ASN1 =
                                     new ASN1SequenceOf(ASN1Any.getInstance()) {
 
         /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPrivateKeyImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPrivateKeyImpl.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPrivateKeyImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPrivateKeyImpl.java Wed May 23 11:48:39 2007
@@ -27,6 +27,7 @@
 package org.apache.harmony.security.provider.crypto;
 
 import java.io.IOException;
+import java.io.NotActiveException;
 import java.math.BigInteger;
 import java.security.interfaces.DSAParams;
 import java.security.interfaces.DSAPrivateKey;
@@ -53,9 +54,9 @@
      */
     private static final long serialVersionUID = -4716227614104950081L;
 
-    private BigInteger x;
+    private BigInteger x, g, p, q;
 
-    private DSAParams params;
+    private transient DSAParams params;
 
     /**
      * Creates object from DSAPrivateKeySpec.
@@ -68,9 +69,9 @@
 
         PrivateKeyInfo pki;
 
-        BigInteger g = keySpec.getG();
-        BigInteger p = keySpec.getP();
-        BigInteger q = keySpec.getQ();
+        g = keySpec.getG();
+        p = keySpec.getP();
+        q = keySpec.getQ();
 
         ThreeIntegerSequence threeInts = new ThreeIntegerSequence(p
                 .toByteArray(), q.toByteArray(), g.toByteArray());
@@ -133,9 +134,10 @@
             throw new InvalidKeySpecException(Messages.getString(
                     "security.19B", e)); //$NON-NLS-1$
         }
-        params = new DSAParameterSpec(new BigInteger(threeInts.p),
-                new BigInteger(threeInts.q), new BigInteger(threeInts.g));
-
+        p = new BigInteger(threeInts.p);
+        q = new BigInteger(threeInts.q);
+        g = new BigInteger(threeInts.g);
+        params = new DSAParameterSpec(p, q, g);
         setEncoding(encoding);
 
         /* 
@@ -152,6 +154,11 @@
 
     public DSAParams getParams() {
         return params;
+    }
+    
+    private void readObject(java.io.ObjectInputStream in) throws NotActiveException, IOException, ClassNotFoundException {
+    	in.defaultReadObject();
+    	params = new DSAParameterSpec(p, q, g);    	
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPublicKeyImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPublicKeyImpl.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPublicKeyImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/DSAPublicKeyImpl.java Wed May 23 11:48:39 2007
@@ -29,6 +29,7 @@
 package org.apache.harmony.security.provider.crypto;
 
 import java.io.IOException;
+import java.io.NotActiveException;
 
 import java.math.BigInteger;
 
@@ -45,12 +46,6 @@
 import org.apache.harmony.security.x509.SubjectPublicKeyInfo;
 
 import org.apache.harmony.security.asn1.ASN1Integer;
-//import org.apache.harmony.security.asn1.ASN1Sequence;
-//import org.apache.harmony.security.asn1.ASN1Type;
-//import org.apache.harmony.security.asn1.BerInputStream;
-//import org.apache.harmony.security.asn1.ASN1BitString;
-//import org.apache.harmony.security.asn1.BitString;
-//import org.apache.harmony.security.asn1.ASN1OctetString;
 
 import org.apache.harmony.security.internal.nls.Messages;
 
@@ -67,9 +62,9 @@
      */
     private static final long serialVersionUID = -2279672131310978336L;
 
-    private BigInteger y;
+    private BigInteger y, g, p, q;
 
-    private DSAParams params;
+    private transient DSAParams params;
 
     /**
      * Creates object from DSAPublicKeySpec.
@@ -82,9 +77,9 @@
 
         SubjectPublicKeyInfo spki;
 
-        BigInteger p = keySpec.getP();
-        BigInteger q = keySpec.getQ();
-        BigInteger g = keySpec.getG();
+        p = keySpec.getP();
+        q = keySpec.getQ();
+        g = keySpec.getG();
 
         ThreeIntegerSequence threeInts = new ThreeIntegerSequence(p
                 .toByteArray(), q.toByteArray(), g.toByteArray());
@@ -148,8 +143,10 @@
             throw new InvalidKeySpecException(Messages.getString(
                     "security.19B", e)); //$NON-NLS-1$
         }
-        params = (DSAParams) (new DSAParameterSpec(new BigInteger(threeInts.p),
-                new BigInteger(threeInts.q), new BigInteger(threeInts.g)));
+        p = new BigInteger(threeInts.p);
+        q = new BigInteger(threeInts.q);
+        g = new BigInteger(threeInts.g);
+        params = (DSAParams) (new DSAParameterSpec(p, q, g));
 
         setEncoding(encoding);
 
@@ -175,6 +172,11 @@
      */
     public DSAParams getParams() {
         return params;
+    }
+    
+    private void readObject(java.io.ObjectInputStream in) throws NotActiveException, IOException, ClassNotFoundException {
+    	in.defaultReadObject();
+    	params = new DSAParameterSpec(p, q, g);    	
     }
 
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/crypto/SHA1withDSA_SignatureImpl.java Wed May 23 11:48:39 2007
@@ -83,7 +83,7 @@
         DSAParams params;
 
         // parameters and private key
-        BigInteger p, q, g, x;
+        BigInteger p, q, x;
 
         int n;
 
@@ -95,7 +95,6 @@
         params = ((DSAPrivateKey) privateKey).getParams();
         p = params.getP();
         q = params.getQ();
-        g = params.getG();
         x = ((DSAPrivateKey) privateKey).getX();
 
         // checks described in DSA standard
@@ -129,7 +128,7 @@
             throws InvalidKeyException {
 
         // parameters and public key
-        BigInteger p, q, g, y;
+        BigInteger p, q, y;
 
         int n1;
 
@@ -141,7 +140,6 @@
         DSAParams params = ((DSAPublicKey) publicKey).getParams();
         p = params.getP();
         q = params.getQ();
-        g = params.getG();
         y = ((DSAPublicKey) publicKey).getY();
 
         // checks described in DSA standard
@@ -207,7 +205,6 @@
 
         // various byte array being used in computing signature
         byte randomBytes[];
-        byte digest[];
         byte rBytes[], sBytes[], signature[];
 
         int n, n1, n2;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValue.java Wed May 23 11:48:39 2007
@@ -301,7 +301,7 @@
     public void appendName(String attrFormat, StringBuffer buf) {
 
         boolean hexFormat = false;
-        if (attrFormat == X500Principal.RFC1779) {
+        if (X500Principal.RFC1779.equals(attrFormat)) {
             if (RFC1779_NAMES == oid.getGroup()) {
                 buf.append(oid.getName());
             } else {
@@ -324,7 +324,7 @@
             if (RFC1779_NAMES == group || RFC2253_NAMES == group) {
                 buf.append(oid.getName());
 
-                if (attrFormat == X500Principal.CANONICAL) {
+                if (X500Principal.CANONICAL.equals(attrFormat)) {
                     // only PrintableString and UTF8String in string format
                     // all others are output in hex format
                     int tag = value.getTag();
@@ -344,7 +344,7 @@
             if (hexFormat) {
                 buf.append(value.getHexString());
             } else {
-                if (attrFormat == X500Principal.CANONICAL) {
+                if (X500Principal.CANONICAL.equals(attrFormat)) {
                     buf.append(value.makeCanonical());
                 } else {
                     buf.append(value.escapedString);
@@ -383,7 +383,7 @@
      *  
      */
 
-    public static ASN1Type AttributeValue = new ASN1Type(
+    public static final ASN1Type attributeValue = new ASN1Type(
             ASN1Constants.TAG_PRINTABLESTRING) {
 
         public boolean checkTag(int tag) {
@@ -472,7 +472,7 @@
     };
 
     public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {
-            ASN1Oid.getInstance(), AttributeValue }) {
+            ASN1Oid.getInstance(), attributeValue }) {
 
         protected Object getDecodedObject(BerInputStream in) throws IOException {
             Object[] values = (Object[]) in.content;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValueComparator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValueComparator.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValueComparator.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/AttributeTypeAndValueComparator.java Wed May 23 11:48:39 2007
@@ -22,6 +22,7 @@
 
 package org.apache.harmony.security.x501;
 
+import java.io.Serializable;
 import java.util.Comparator;
 
 import org.apache.harmony.security.utils.ObjectIdentifier;
@@ -30,9 +31,11 @@
  * AttributeTypeAndValue comparator
  * 
  */
-public class AttributeTypeAndValueComparator implements Comparator {
+public class AttributeTypeAndValueComparator implements Comparator, Serializable {
 
-    /**
+	private static final long serialVersionUID = -1286471842007103132L;
+
+	/**
      * compares two AttributeTypeAndValues
      * 
      * @param obj1
@@ -63,14 +66,7 @@
 
         return compateOids(atav1.getType(), atav2.getType());
     }
-
-    /**
-     * @return false
-     */
-    public boolean equals(Object obj) {
-        return false;
-    }
-
+    
     /**
      * compares two Object identifiers
      * 

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/Name.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/Name.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/Name.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x501/Name.java Wed May 23 11:48:39 2007
@@ -118,21 +118,21 @@
         //
         // check X500Principal constants first
         //
-        if (format == X500Principal.RFC1779) {
+        if (X500Principal.RFC1779.equals(format)) {
 
             if (rfc1779String == null) {
                 rfc1779String = getName0(format);
             }
             return rfc1779String;
 
-        } else if (format == X500Principal.RFC2253) {
+        } else if (X500Principal.RFC2253.equals(format)) {
 
             if (rfc2253String == null) {
                 rfc2253String = getName0(format);
             }
             return rfc2253String;
 
-        } else if (format == X500Principal.CANONICAL) {
+        } else if (X500Principal.CANONICAL.equals(format)) {
 
             if (canonicalString == null) {
                 canonicalString = getName0(format);
@@ -217,7 +217,7 @@
         }
 
         String sName = name.toString();
-        if (format == X500Principal.CANONICAL) {
+        if (X500Principal.CANONICAL.equals(format)) {
             sName = sName.toLowerCase(Locale.US);
         }
         return sName;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java Wed May 23 11:48:39 2007
@@ -143,6 +143,11 @@
                     : Arrays.equals(parameters, algid.parameters));
     }
     
+    public int hashCode() {
+    	return algorithm.hashCode() * 37 + 
+    		(parameters != null ? parameters.hashCode() : 0);
+    }
+    
     /**
      * Places the string representation into the StringBuffer object.
      */

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java Wed May 23 11:48:39 2007
@@ -103,7 +103,7 @@
         buffer.append(prefix).append("]\n"); //$NON-NLS-1$
     }
 
-    public static ASN1Type ASN1 = new ASN1Sequence(
+    public static final ASN1Type ASN1 = new ASN1Sequence(
             new ASN1Type[] {
                 new ASN1Implicit(0, ASN1OctetString.getInstance()),
                 new ASN1Implicit(1, GeneralNames.ASN1),

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java Wed May 23 11:48:39 2007
@@ -105,7 +105,7 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = new ASN1Sequence(new ASN1Type[] {
+    public static final ASN1Type ASN1 = new ASN1Sequence(new ASN1Type[] {
             ASN1Boolean.getInstance(), ASN1Integer.getInstance() }) {
         {
             setDefault(Boolean.FALSE, 0);

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java Wed May 23 11:48:39 2007
@@ -84,5 +84,5 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = ASN1Integer.getInstance();
+    public static final ASN1Type ASN1 = ASN1Integer.getInstance();
 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java Wed May 23 11:48:39 2007
@@ -87,7 +87,7 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = new ASN1Sequence(new ASN1Type[] {
+    public static final ASN1Type ASN1 = new ASN1Sequence(new ASN1Type[] {
         GeneralName.ASN1
     }) {
         public Object getDecodedObject(BerInputStream in) {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java Wed May 23 11:48:39 2007
@@ -109,7 +109,7 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 =
+    public static final ASN1Type ASN1 =
         new ASN1SequenceOf(new ASN1Oid() {
 
             public Object getDecodedObject(BerInputStream in)

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java Wed May 23 11:48:39 2007
@@ -58,34 +58,34 @@
     
     // constants: the extension OIDs
     // certificate extensions:
-    public static final int[] SUBJ_DIRECTORY_ATTRS = {2, 5, 29, 9};
-    public static final int[] SUBJ_KEY_ID = {2, 5, 29, 14};
-    public static final int[] KEY_USAGE = {2, 5, 29, 15};
-    public static final int[] PRIVATE_KEY_USAGE_PERIOD = {2, 5, 29, 16};
-    public static final int[] SUBJECT_ALT_NAME = {2, 5, 29, 17};
-    public static final int[] ISSUER_ALTERNATIVE_NAME = {2, 5, 29, 18};
-    public static final int[] BASIC_CONSTRAINTS = {2, 5, 29, 19};
-    public static final int[] NAME_CONSTRAINTS = {2, 5, 29, 30};
-    public static final int[] CRL_DISTR_POINTS = {2, 5, 29, 31};
-    public static final int[] CERTIFICATE_POLICIES = {2, 5, 29, 32};
-    public static final int[] POLICY_MAPPINGS = {2, 5, 29, 33};
-    public static final int[] AUTH_KEY_ID = {2, 5, 29, 35};
-    public static final int[] POLICY_CONSTRAINTS = {2, 5, 29, 36};
-    public static final int[] EXTENDED_KEY_USAGE = {2, 5, 29, 37};
-    public static final int[] FRESHEST_CRL = {2, 5, 29, 46};
-    public static final int[] INHIBIT_ANY_POLICY = {2, 5, 29, 54};
-    public static final int[] AUTHORITY_INFO_ACCESS =
+    static final int[] SUBJ_DIRECTORY_ATTRS = {2, 5, 29, 9};
+    static final int[] SUBJ_KEY_ID = {2, 5, 29, 14};
+    static final int[] KEY_USAGE = {2, 5, 29, 15};
+    static final int[] PRIVATE_KEY_USAGE_PERIOD = {2, 5, 29, 16};
+    static final int[] SUBJECT_ALT_NAME = {2, 5, 29, 17};
+    static final int[] ISSUER_ALTERNATIVE_NAME = {2, 5, 29, 18};
+    static final int[] BASIC_CONSTRAINTS = {2, 5, 29, 19};
+    static final int[] NAME_CONSTRAINTS = {2, 5, 29, 30};
+    static final int[] CRL_DISTR_POINTS = {2, 5, 29, 31};
+    static final int[] CERTIFICATE_POLICIES = {2, 5, 29, 32};
+    static final int[] POLICY_MAPPINGS = {2, 5, 29, 33};
+    static final int[] AUTH_KEY_ID = {2, 5, 29, 35};
+    static final int[] POLICY_CONSTRAINTS = {2, 5, 29, 36};
+    static final int[] EXTENDED_KEY_USAGE = {2, 5, 29, 37};
+    static final int[] FRESHEST_CRL = {2, 5, 29, 46};
+    static final int[] INHIBIT_ANY_POLICY = {2, 5, 29, 54};
+    static final int[] AUTHORITY_INFO_ACCESS =
                                             {1, 3, 6, 1, 5, 5, 7, 1, 1};
-    public static final int[] SUBJECT_INFO_ACCESS =
+    static final int[] SUBJECT_INFO_ACCESS =
                                             {1, 3, 6, 1, 5, 5, 7, 1, 11};
     // crl extensions:
-    public static final int[] ISSUING_DISTR_POINT = {2, 5, 29, 28};
+    static final int[] ISSUING_DISTR_POINT = {2, 5, 29, 28};
     // crl entry extensions:
-    public static final int[] CRL_NUMBER = {2, 5, 29, 20};
-    public static final int[] CERTIFICATE_ISSUER = {2, 5, 29, 29};
-    public static final int[] INVALIDITY_DATE = {2, 5, 29, 24};
-    public static final int[] REASON_CODE = {2, 5, 29, 21};
-    public static final int[] ISSUING_DISTR_POINTS = {2, 5, 29, 28};
+    static final int[] CRL_NUMBER = {2, 5, 29, 20};
+    static final int[] CERTIFICATE_ISSUER = {2, 5, 29, 29};
+    static final int[] INVALIDITY_DATE = {2, 5, 29, 24};
+    static final int[] REASON_CODE = {2, 5, 29, 21};
+    static final int[] ISSUING_DISTR_POINTS = {2, 5, 29, 28};
     
     // the value of extnID field of the structure
     private final int[] extnID;
@@ -237,6 +237,10 @@
         return Arrays.equals(extnID, extn.extnID) 
             && (critical == extn.critical)
             && Arrays.equals(extnValue, extn.extnValue);
+    }
+    
+    public int hashCode() {
+    	return (extnID.hashCode() * 37 + (critical ? 1 : 0)) * 37 + extnValue.hashCode();
     }
 
     public ExtensionValue getDecodedExtensionValue() throws IOException {

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java Wed May 23 11:48:39 2007
@@ -386,6 +386,14 @@
                 );
     }
     
+    public int hashCode() {
+    	int hashcode = 0;
+    	if (extensions != null) {
+    		hashcode = extensions.hashCode();
+    	}
+    	return hashcode;
+    }
+    
     /**
      * Places the string representation into the StringBuffer object.
      */

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralName.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralName.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralName.java Wed May 23 11:48:39 2007
@@ -328,6 +328,24 @@
         return false;
     }
     
+	public int hashCode() {
+		switch(tag) {
+	        case RFC822_NAME:
+	        case DNS_NAME:
+	        case UR_ID:
+	        case REG_ID:
+	        case IP_ADDR: 
+	            return name.hashCode();
+	        case DIR_NAME: 
+	        case X400_ADDR:
+	        case OTHER_NAME:
+	        case EDIP_NAME:
+	            return getEncoded().hashCode();
+	        default:
+	            return super.hashCode();
+		}
+	}
+    
     /**
      * Checks if the other general name is acceptable by this object.
      * The name is acceptable if it has the same type name and its
@@ -585,7 +603,7 @@
             if (ch == '.') {
                 // check the end of the previous label, it should not
                 // be '-' sign
-                if (bytes[i-i] == '-') {
+                if (bytes[i-1] == '-') {
                     throw new IOException(
                             Messages.getString("security.186", dns)); //$NON-NLS-1$
                 }

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java Wed May 23 11:48:39 2007
@@ -82,6 +82,6 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = ASN1GeneralizedTime.getInstance();
+    public static final ASN1Type ASN1 = ASN1GeneralizedTime.getInstance();
 }
 

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java Wed May 23 11:48:39 2007
@@ -180,7 +180,7 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = new ASN1Sequence(
+    public static final ASN1Type ASN1 = new ASN1Sequence(
             new ASN1Type[] {
                 // ASN.1 prohibits implicitly tagged CHOICE
                 new ASN1Explicit(0, DistributionPointName.ASN1),

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java Wed May 23 11:48:39 2007
@@ -128,6 +128,6 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1Type ASN1 = ASN1Enumerated.getInstance();
+    public static final ASN1Type ASN1 = ASN1Enumerated.getInstance();
 }
 

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java Wed May 23 11:48:39 2007
@@ -55,7 +55,7 @@
     /**
      * The names of the reasons.
      */
-    public static final String[] REASONS = {
+    static final String[] REASONS = {
         "unused", //$NON-NLS-1$
         "keyCompromise", //$NON-NLS-1$
         "cACompromise", //$NON-NLS-1$
@@ -97,7 +97,7 @@
     /**
      * ASN.1 Encoder/Decoder.
      */
-    public static ASN1BitString ASN1 = 
+    public static final ASN1BitString ASN1 = 
                             new ASN1BitString.ASN1NamedBitList(REASONS.length) {
         public Object getDecodedObject(BerInputStream in) throws IOException {
             return new ReasonFlags((boolean[]) super.getDecodedObject(in));

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java Wed May 23 11:48:39 2007
@@ -153,6 +153,11 @@
                     ? rcert.crlEntryExtensions == null
                     : crlEntryExtensions.equals(rcert.crlEntryExtensions));
         }
+        
+        public int hashCode() {
+        	return userCertificate.hashCode() * 37 + (int)revocationDate.getTime() / 1000
+        	+ (crlEntryExtensions == null ? 0 : crlEntryExtensions.hashCode());
+        }
 
         /**
          * Places the string representation of extension value
@@ -171,7 +176,7 @@
             }
         }
         
-        public static ASN1Sequence ASN1 = new ASN1Sequence(
+        public static final ASN1Sequence ASN1 = new ASN1Sequence(
                 new ASN1Type[] {ASN1Integer.getInstance(), Time.ASN1,
                 Extensions.ASN1}) {
             {
@@ -357,6 +362,12 @@
             && ((crlExtensions == null)
                     ? tbscert.crlExtensions == null
                     : crlExtensions.equals(tbscert.crlExtensions));
+    }
+    
+    public int hashCode() {
+    	return ((version * 37 + signature.hashCode()) * 37
+    		+ issuer.getEncoded().hashCode()) * 37
+    		+ (int)thisUpdate.getTime() / 1000;
     }
 
     /**

Modified: harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/tsp/PKIStatusInfo.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/tsp/PKIStatusInfo.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/tsp/PKIStatusInfo.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/tsp/PKIStatusInfo.java Wed May 23 11:48:39 2007
@@ -122,8 +122,7 @@
             
             int failInfoValue = -1;
             if (values[2] != null) {
-                boolean[] failInfoBoolArray = (values[2] == null) ? null
-                        : ((BitString) values[2]).toBooleanArray();
+                boolean[] failInfoBoolArray = ((BitString) values[2]).toBooleanArray();
                 for (int i = 0; i < failInfoBoolArray.length; i++) {
                     if (failInfoBoolArray[i]) {
                         failInfoValue = i;

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStoreTest.java Wed May 23 11:48:39 2007
@@ -237,6 +237,11 @@
         // Regression for HARMONY-1539
         // no exception expected
         assertNull(new KeyStore.PasswordProtection(null).getPassword());
+        char[] password = new char[] {'a', 'b', 'c'};
+        KeyStore.PasswordProtection pp = new KeyStore.PasswordProtection(password);
+        assertNotSame(pp.getPassword(), password);
+        assertSame(pp.getPassword(), pp.getPassword());
+        
     }
 
 

Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java?view=diff&rev=541025&r1=541024&r2=541025
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/TimestampTest.java Wed May 23 11:48:39 2007
@@ -85,7 +85,9 @@
     }
 
     public void testGetTimestamp() {
-        assertEquals(new Timestamp(now, cpath).getTimestamp(), now);
+    	Timestamp t = new Timestamp(now, cpath);
+        assertEquals(now, t.getTimestamp());
+        assertNotSame(now, t.getTimestamp());
     }
 
     /*



Mime
View raw message