>From 9743360b06aa0b0daf7a7cf3588a4dfcdfd712f1 Mon Sep 17 00:00:00 2001
From: Abhishek Koneru <akoneru@redhat.com>
Date: Fri, 15 Jun 2012 13:44:46 -0400
Subject: [PATCH] Fixes for Review Comments for PATCH 12

---
 base/ca/src/com/netscape/ca/CMSCRLExtensions.java  |    2 +-
 base/ca/src/com/netscape/ca/CRLIssuingPoint.java   |   25 +++++------
 .../netscape/certsrv/common/NameValuePairs.java    |    4 +-
 .../netscape/cmscore/base/SimpleProperties.java    |   38 +++++++++-------
 .../src/com/netscape/cmscore/logging/Auditor.java  |    6 +--
 .../common/src/com/netscape/cmscore/realm/ACL.java |    6 +--
 .../netscape/cmscore/request/ExtDataHashtable.java |   11 -----
 .../com/netscape/cmscore/request/RequestTest.java  |   40 ++++++++++-------
 .../src/com/netscape/cmstools/CMCResponse.java     |    4 +-
 .../src/com/netscape/cmstools/PrettyPrintCert.java |    4 +-
 .../netscape/pkisilent/common/CMSProperties.java   |   37 ++++++++-------
 .../netscape/security/pkcs/PKCS10Attributes.java   |   43 +++++++++---------
 .../netscape/security/provider/DSAPrivateKey.java  |   43 +++++++++---------
 .../netscape/security/provider/DSAPublicKey.java   |   47 ++++++++++----------
 base/util/src/netscape/security/x509/AlgIdDSA.java |   13 +++++-
 .../src/netscape/security/x509/CRLExtensions.java  |   43 +++++++++---------
 .../security/x509/CertificateExtensions.java       |   43 +++++++++---------
 .../src/netscape/security/x509/Extensions.java     |   43 +++++++++---------
 18 files changed, 234 insertions(+), 218 deletions(-)

diff --git a/base/ca/src/com/netscape/ca/CMSCRLExtensions.java b/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
index 72d6c5a6474cd2e65000248ba59550776db013a2..11f810af2ae221b3695575fc68150b1e1c73985f 100644
--- a/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
+++ b/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
@@ -583,7 +583,7 @@ public class CMSCRLExtensions implements ICMSCRLExtensions {
         }
 
         for (Map.Entry<String,String> entry : nvp.entrySet()) {
-            String name= entry.getKey();
+            String name = entry.getKey();
             String value = entry.getValue();
 
             if (name.equals(PROP_ENABLE)) {
diff --git a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
index f58e60bd454b78d773c5f6ccec6c736e0c6a9210..46891fd6b2c425da40b9263906111b2b34db4543 100644
--- a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
+++ b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
@@ -2709,7 +2709,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
                 long totalTime = 0;
                 long crlTime = 0;
                 long deltaTime = 0;
-                StringBuffer splitTimes = new StringBuffer("  (");
+                StringBuilder splitTimes = new StringBuilder("  (");
                 for (int i = 0; i < mSplits.length; i++) {
                     totalTime += mSplits[i];
                     if (i > 0 && i < 5) {
@@ -2719,10 +2719,9 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
                     }
                     if (i > 0)
                         splitTimes.append(",");
-                    splitTimes.append(Long.toString(mSplits[i]));
+                    splitTimes.append(mSplits[i]);
                 }
-                splitTimes.append("," + Long.toString(deltaTime) + "," + Long.toString(crlTime) + ","
-                        + Long.toString(totalTime) + ")");
+                splitTimes.append(String.format(",%d,%d,%d)",deltaTime,crlTime,totalTime));
                 mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER,
                             AuditFormat.LEVEL,
                             CMS.getLogMessage("CMSCORE_CA_CA_CRL_UPDATED"),
@@ -2734,7 +2733,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
                                     Long.toString(mCRLSize),
                                     Long.toString(totalTime),
                                     Long.toString(crlTime),
-                                    Long.toString(deltaTime) + splitTimes.toString()
+                                    Long.toString(deltaTime) + splitTimes
                             }
                            );
                 CMS.debug("Finished Logging CRL Update to transaction log");
@@ -3095,14 +3094,14 @@ class CertRecProcessor implements IElementProcessor {
             return includeCert;
         }
         boolean reasonMatch = false;
-            if (mOnlySomeReasons != null) {
-                reasonMatch = mOnlySomeReasons.get(reasonIndex);
-                if (reasonMatch != true) {
-                    includeCert = false;
-                } else {
-                    CMS.debug("onlySomeReasons match! reason: " + reason);
-                }
+        if (mOnlySomeReasons != null) {
+            reasonMatch = mOnlySomeReasons.get(reasonIndex);
+            if (reasonMatch != true) {
+                includeCert = false;
+            } else {
+                CMS.debug("onlySomeReasons match! reason: " + reason);
             }
+        }
 
         return includeCert;
     }
@@ -3148,7 +3147,7 @@ class CertRecProcessor implements IElementProcessor {
 
             if (includeCert == true) {
                 mCRLCerts.put(serialNumber, newRevokedCert);
-                    CMS.debug("Putting certificate serial: 0x" + serialNumber.toString(16) + " into CRL hashtable");
+                CMS.debug("Putting certificate serial: 0x" + serialNumber.toString(16) + " into CRL hashtable");
             }
         } catch (EBaseException e) {
             CMS.debug(
diff --git a/base/common/src/com/netscape/certsrv/common/NameValuePairs.java b/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
index 2060f953111f49f795a62f0f6d9ee58908a8d11b..30491cdd050d6d0ff9af8b3d1031fe4b17953e5f 100644
--- a/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
+++ b/base/common/src/com/netscape/certsrv/common/NameValuePairs.java
@@ -44,11 +44,11 @@ public class NameValuePairs extends LinkedHashMap<String, String> {
      * @return string representation
      */
     public String toString() {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
 
         for (Map.Entry<String, String> entry : entrySet()) {
 
-            buf.append(entry.getKey() + "=" + entry.getValue());
+            buf.append(String.format("%s=%s", entry.getKey(), entry.getValue()));
             buf.append("\n");
         }
 
diff --git a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
index a8385b1e66421671733162d4677c37b9ac199a3c..c1ec27a8cb8397efb7fedc15309ef2027b67701b 100644
--- a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
+++ b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java
@@ -455,24 +455,28 @@ public class SimpleProperties extends Hashtable<String, String> {
     }
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((defaults == null) ? 0 : defaults.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
             return false;
-        }
-        if (o instanceof SimpleProperties) {
-            SimpleProperties rhs = (SimpleProperties) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.defaults == null) {
-                if (rhs.defaults != null) {
-                    return false;
-                }
-            } else if (!this.defaults.equals(rhs.defaults)) {
+        if (getClass() != obj.getClass())
+            return false;
+        SimpleProperties other = (SimpleProperties) obj;
+        if (defaults == null) {
+            if (other.defaults != null)
                 return false;
-            }
-            return super.equals(rhs);
-        }
-        return false;
+        } else if (!defaults.equals(other.defaults))
+            return false;
+        return true;
     }
+
 }
diff --git a/base/common/src/com/netscape/cmscore/logging/Auditor.java b/base/common/src/com/netscape/cmscore/logging/Auditor.java
index 5109bcc7fae16ec9d3d77984d5c2992eb99befc0..f0bcb5bee3b36c654889921f6fcc5b1d5046c44e 100644
--- a/base/common/src/com/netscape/cmscore/logging/Auditor.java
+++ b/base/common/src/com/netscape/cmscore/logging/Auditor.java
@@ -96,15 +96,15 @@ public class Auditor implements IAuditor {
 
         // if no signed audit object exists, bail
         if (signedAuditLogger == null) return null;
-        StringBuffer parameters;
+        StringBuilder parameters = new StringBuilder();
 
         // always identify the scope of the request
         if (scope != null) {
-            parameters = new StringBuffer(SIGNED_AUDIT_SCOPE
+            parameters.append(SIGNED_AUDIT_SCOPE
                     + SIGNED_AUDIT_NAME_VALUE_DELIMITER
                     + scope);
         } else {
-            parameters = new StringBuffer(SIGNED_AUDIT_EMPTY_NAME_VALUE_PAIR);
+            parameters.append(SIGNED_AUDIT_EMPTY_NAME_VALUE_PAIR);
         }
 
         // identify the operation type of the request
diff --git a/base/common/src/com/netscape/cmscore/realm/ACL.java b/base/common/src/com/netscape/cmscore/realm/ACL.java
index 57b9ef6448c05cba0aaff6e307ba7142b483578e..13fcdac448903b79f7df703968346590f6b443df 100644
--- a/base/common/src/com/netscape/cmscore/realm/ACL.java
+++ b/base/common/src/com/netscape/cmscore/realm/ACL.java
@@ -150,17 +150,17 @@ public class ACL  {
      *         <resource name>[<ACLEntry1>,<ACLEntry 2>,...<ACLEntry N>]
      */
     public String toString() {
-        StringBuffer entries = new StringBuffer();
+        StringBuilder entries = new StringBuilder();
         Enumeration<ACLEntry> e = entries();
 
         for (; e.hasMoreElements();) {
             ACLEntry entry = e.nextElement();
 
-            entries.append(entry.toString());
+            entries.append(entry);
             if (e.hasMoreElements())
                 entries.append(",");
         }
-        return getName() + "[" + entries.toString() + "]";
+        return getName() + "[" + entries + "]";
     }
 
     /**
diff --git a/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java
index 3f55b5f67e49d7ad4cfa3ade367653b706d38f94..317b8e56c8df53876cd6aa3f2c6b61f63040dc35 100644
--- a/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java
+++ b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java
@@ -1,9 +1,7 @@
 package com.netscape.cmscore.request;
 
 import java.util.Hashtable;
-import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * Subclass of Hashtable returned by IRequest.getExtDataInHashtable. Its
@@ -56,15 +54,6 @@ public class ExtDataHashtable<V> extends Hashtable<String, V> {
         return super.put(oKey.toLowerCase(), val);
     }
 
-    public void putAll(Map<? extends String, ? extends V> map) {
-        Set<?> keys = map.entrySet();
-        for (Iterator<?> i = keys.iterator(); i.hasNext();) {
-            @SuppressWarnings("unchecked")
-            Map.Entry<? extends String, ? extends V> entry = (Map.Entry<? extends String, ? extends V>) i.next();
-            put(entry.getKey(), entry.getValue());
-        }
-    }
-
     public V remove(Object o) {
         if (o instanceof String) {
             String key = (String) o;
diff --git a/base/common/test/com/netscape/cmscore/request/RequestTest.java b/base/common/test/com/netscape/cmscore/request/RequestTest.java
index ba0f49e3613b0525d023ca04e69b3c54168e32c6..7a655fd0848d861729724376e779f007437d5ea6 100644
--- a/base/common/test/com/netscape/cmscore/request/RequestTest.java
+++ b/base/common/test/com/netscape/cmscore/request/RequestTest.java
@@ -633,24 +633,34 @@ public class RequestTest extends CMSBaseTestCase {
         }
 
         @Override
-        public boolean equals(Object other) {
-            if (other == null) {
-                return false;
-            }
+        public int hashCode() {
+            final int prime = 31;
+            int result = super.hashCode();
+            result = prime * result + getOuterType().hashCode();
+            result = prime * result + (getEncodedCalled ? 1231 : 1237);
+            return result;
+        }
 
-            if (other instanceof X509CertInfoStub) {
-                X509CertInfoStub rhs = (X509CertInfoStub) other;
-                if (this == rhs) {
-                    return true;
-                }
-                if (this.getEncodedCalled ^ rhs.getEncodedCalled) {
-                    return false;
-                }
-                return super.equals(other);
-            }
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (!super.equals(obj))
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            X509CertInfoStub other = (X509CertInfoStub) obj;
+            if (!getOuterType().equals(other.getOuterType()))
+                return false;
+            if (getEncodedCalled != other.getEncodedCalled)
+                return false;
+            return true;
+        }
 
-            return false;
+        private RequestTest getOuterType() {
+            return RequestTest.this;
         }
+
     }
 
     class RevokedCertImplStub extends RevokedCertImpl {
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
index 036afadea3712b61d8d98fd9769cb8a68fbf65a1..50db485a475d79000db29700defaa19de223ffe7 100644
--- a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
+++ b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
@@ -122,12 +122,12 @@ public class CMCResponse {
                                 ASN1Util.encode(sts.elementAt(j)));
                         SEQUENCE seq = cst.getBodyList();
 
-                        StringBuffer s = new StringBuffer("   BodyList: ");
+                        StringBuilder s = new StringBuilder("   BodyList: ");
                         for (int k = 0; k < seq.size(); k++) {
                             INTEGER n = (INTEGER) seq.elementAt(k);
                             s.append(n.toString() + " ");
                         }
-                        System.out.println(s.toString());
+                        System.out.println(s);
                         int st = cst.getStatus();
                         if (st != CMCStatusInfo.SUCCESS && st != CMCStatusInfo.CONFIRM_REQUIRED) {
                             String stString = cst.getStatusString();
diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
index a8e0723382e5d9b5352dbef999bbec05bd70f0cd..100304cfe692b360233bfa130ef463f6234d25ad 100644
--- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
+++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
@@ -86,7 +86,7 @@ public class PrettyPrintCert {
         X509CertImpl cert = null;
         Locale aLocale = null;
         CertPrettyPrint certDetails = null;
-        StringBuffer pp = new StringBuffer();
+        StringBuilder pp = new StringBuilder();
         FileOutputStream outputCert = null;
         boolean mSimpleInfo = false;
         String inputfile = null;
@@ -218,7 +218,7 @@ public class PrettyPrintCert {
         // (10) Finally, "pretty print" the actual certificate to the console
         //      unless an output file has been specified
         if (outputfile == null) {
-            System.out.println(pp.toString());
+            System.out.println(pp);
         } else {
             try {
                 outputCert = new FileOutputStream(outputfile);
diff --git a/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java b/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
index ed3d7e32edd4a9d0a296af3a6a4a4af05598beab..5cf5134170f6b392af1abbd71ff22720ad96cacf 100644
--- a/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
+++ b/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java
@@ -677,24 +677,27 @@ class CMSProperties extends Hashtable<String, String> {
     };
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((defaults == null) ? 0 : defaults.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
             return false;
-        }
-        if (o instanceof CMSProperties) {
-            CMSProperties rhs = (CMSProperties) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.defaults == null) {
-                if (rhs.defaults != null) {
-                    return false;
-                }
-            } else if (!this.defaults.equals(rhs.defaults)) {
+        if (getClass() != obj.getClass())
+            return false;
+        CMSProperties other = (CMSProperties) obj;
+        if (defaults == null) {
+            if (other.defaults != null)
                 return false;
-            }
-            return super.equals(rhs);
-        }
-        return false;
+        } else if (!defaults.equals(other.defaults))
+            return false;
+        return true;
     }
 }
diff --git a/base/util/src/netscape/security/pkcs/PKCS10Attributes.java b/base/util/src/netscape/security/pkcs/PKCS10Attributes.java
index c539be5c66f44bd62ae760e31ba60296ae80f828..22a0dce21ddc6ca5b65ca770eda338c1d68fb851 100644
--- a/base/util/src/netscape/security/pkcs/PKCS10Attributes.java
+++ b/base/util/src/netscape/security/pkcs/PKCS10Attributes.java
@@ -146,27 +146,28 @@ public class PKCS10Attributes extends Vector<PKCS10Attribute> implements DerEnco
     }
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-        if (o instanceof PKCS10Attributes) {
-            PKCS10Attributes rhs = (PKCS10Attributes) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.map == null) {
-                if (rhs.map != null) {
-                    return false;
-                }
-            } else {
-                if (!this.map.equals(rhs.map)) {
-                    return false;
-                }
-            }
-            return super.equals(rhs);
-        }
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((map == null) ? 0 : map.hashCode());
+        return result;
+    }
 
-        return false;
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        PKCS10Attributes other = (PKCS10Attributes) obj;
+        if (map == null) {
+            if (other.map != null)
+                return false;
+        } else if (!map.equals(other.map))
+            return false;
+        return true;
     }
+
 }
diff --git a/base/util/src/netscape/security/provider/DSAPrivateKey.java b/base/util/src/netscape/security/provider/DSAPrivateKey.java
index bb27412eef7291e0330916b69d6fc6800100c1d3..385aa173c1af3af7700ed3833cbb90fb9c1e0526 100644
--- a/base/util/src/netscape/security/provider/DSAPrivateKey.java
+++ b/base/util/src/netscape/security/provider/DSAPrivateKey.java
@@ -143,29 +143,28 @@ public final class DSAPrivateKey extends PKCS8Key
     }
 
     @Override
-    public boolean equals(Object object) {
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((x == null) ? 0 : x.hashCode());
+        return result;
+    }
 
-        if (object == null) {
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
             return false;
-        }
-        if (object instanceof DSAPrivateKey) {
-            DSAPrivateKey rhs = (DSAPrivateKey) object;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.x == null) {
-                if (rhs.x != null) {
-                    return false;
-                }
-            } else {
-                if (!this.x.equals(rhs.x)) {
-                    return false;
-                }
-            }
-            return super.equals(rhs);
-        }
-
-        return false;
-
+        if (getClass() != obj.getClass())
+            return false;
+        DSAPrivateKey other = (DSAPrivateKey) obj;
+        if (x == null) {
+            if (other.x != null)
+                return false;
+        } else if (!x.equals(other.x))
+            return false;
+        return true;
     }
+
 }
diff --git a/base/util/src/netscape/security/provider/DSAPublicKey.java b/base/util/src/netscape/security/provider/DSAPublicKey.java
index b52ebbe46d681f1370be778c18861170b35fbb08..481b9ee7fa8b9d3d7740f21a845c7ea1b427fd16 100644
--- a/base/util/src/netscape/security/provider/DSAPublicKey.java
+++ b/base/util/src/netscape/security/provider/DSAPublicKey.java
@@ -131,30 +131,29 @@ public final class DSAPublicKey extends X509Key
         }
     }
 
-   @Override
-    public boolean equals(Object object) {
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((y == null) ? 0 : y.hashCode());
+        return result;
+    }
 
-       if (object == null) {
-           return false;
-       }
-       if (object instanceof DSAPrivateKey) {
-           DSAPublicKey rhs = (DSAPublicKey) object;
-           if (this == rhs) {
-               return true;
-           }
-           if (this.y == null) {
-               if (rhs.y != null) {
-                   return false;
-               }
-           } else {
-               if (!this.y.equals(rhs.y)) {
-                   return false;
-               }
-           }
-           return super.equals(rhs);
-       }
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        DSAPublicKey other = (DSAPublicKey) obj;
+        if (y == null) {
+            if (other.y != null)
+                return false;
+        } else if (!y.equals(other.y))
+            return false;
+        return true;
+    }
 
-       return false;
-
-   }
 }
diff --git a/base/util/src/netscape/security/x509/AlgIdDSA.java b/base/util/src/netscape/security/x509/AlgIdDSA.java
index 523a31572f7936732e3a836315c5b49c5389b2d4..1f00b0355d4c3a6aa9dc77553ebb0769acb4aa80 100644
--- a/base/util/src/netscape/security/x509/AlgIdDSA.java
+++ b/base/util/src/netscape/security/x509/AlgIdDSA.java
@@ -176,8 +176,17 @@ public final class AlgIdDSA extends AlgorithmId implements DSAParams {
     }
 
     @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((g == null) ? 0 : g.hashCode());
+        result = prime * result + ((p == null) ? 0 : p.hashCode());
+        result = prime * result + ((q == null) ? 0 : q.hashCode());
+        return result;
+    }
+
+    @Override
     public boolean equals(Object other) {
-
         if (other == null) {
             return false;
         }
@@ -191,7 +200,6 @@ public final class AlgIdDSA extends AlgorithmId implements DSAParams {
             }
             return super.equals(rhs);
         }
-
         return false;
     }
 
@@ -207,4 +215,5 @@ public final class AlgIdDSA extends AlgorithmId implements DSAParams {
         }
         return true;
     }
+
 }
diff --git a/base/util/src/netscape/security/x509/CRLExtensions.java b/base/util/src/netscape/security/x509/CRLExtensions.java
index 33c383bb7dcb3ee48f5b1e394f17f5b9213d8446..9c844cd3dc0b13bd1ffbf01c62d478e1351f6a4a 100755
--- a/base/util/src/netscape/security/x509/CRLExtensions.java
+++ b/base/util/src/netscape/security/x509/CRLExtensions.java
@@ -228,27 +228,28 @@ public class CRLExtensions extends Vector<Extension> {
     }
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-        if (o instanceof CRLExtensions) {
-            CRLExtensions rhs = (CRLExtensions) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.map == null) {
-                if (rhs.map != null) {
-                    return false;
-                }
-            } else {
-                if (!this.map.equals(rhs.map)) {
-                    return false;
-                }
-            }
-            return super.equals(rhs);
-        }
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((map == null) ? 0 : map.hashCode());
+        return result;
+    }
 
-        return false;
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        CRLExtensions other = (CRLExtensions) obj;
+        if (map == null) {
+            if (other.map != null)
+                return false;
+        } else if (!map.equals(other.map))
+            return false;
+        return true;
     }
+
 }
diff --git a/base/util/src/netscape/security/x509/CertificateExtensions.java b/base/util/src/netscape/security/x509/CertificateExtensions.java
index a0b90bf27e3eef2c410065da621d481da8e1c074..93be196ab1f8413b7ab98446a407b2228c646b4c 100644
--- a/base/util/src/netscape/security/x509/CertificateExtensions.java
+++ b/base/util/src/netscape/security/x509/CertificateExtensions.java
@@ -275,27 +275,28 @@ public class CertificateExtensions extends Vector<Extension>
     }
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-        if (o instanceof CertificateExtensions) {
-            CertificateExtensions rhs = (CertificateExtensions) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.map == null) {
-                if (rhs.map != null) {
-                    return false;
-                }
-            } else {
-                if (!this.map.equals(rhs.map)) {
-                    return false;
-                }
-            }
-            return super.equals(rhs);
-        }
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((map == null) ? 0 : map.hashCode());
+        return result;
+    }
 
-        return false;
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        CertificateExtensions other = (CertificateExtensions) obj;
+        if (map == null) {
+            if (other.map != null)
+                return false;
+        } else if (!map.equals(other.map))
+            return false;
+        return true;
     }
+
 }
diff --git a/base/util/src/netscape/security/x509/Extensions.java b/base/util/src/netscape/security/x509/Extensions.java
index 8dc3b478e17c7bf7f52c632ddd076741325d1013..109f795e906dfcba8eacd84cf905681ee901533c 100644
--- a/base/util/src/netscape/security/x509/Extensions.java
+++ b/base/util/src/netscape/security/x509/Extensions.java
@@ -225,27 +225,28 @@ public class Extensions extends Vector<Extension>
     }
 
     @Override
-    public synchronized boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-        if (o instanceof Extensions) {
-            Extensions rhs = (Extensions) o;
-            if (this == rhs) {
-                return true;
-            }
-            if (this.map == null) {
-                if (rhs.map != null) {
-                    return false;
-                }
-            } else {
-                if (!this.map.equals(rhs.map)) {
-                    return false;
-                }
-            }
-            return super.equals(rhs);
-        }
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + ((map == null) ? 0 : map.hashCode());
+        return result;
+    }
 
-        return false;
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (!super.equals(obj))
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        Extensions other = (Extensions) obj;
+        if (map == null) {
+            if (other.map != null)
+                return false;
+        } else if (!map.equals(other.map))
+            return false;
+        return true;
     }
+
 }
-- 
1.7.10.2

