diff options
author | Abhishek Koneru <akoneru@redhat.com> | 2012-07-11 14:54:32 -0400 |
---|---|---|
committer | Endi Sukma Dewata <edewata@redhat.com> | 2012-07-18 10:41:46 -0500 |
commit | 6cd64781a7cda192bc2b0a555974037fd16cc2c5 (patch) | |
tree | 1145e67bb8b736e47c11dd3485d635e53b1931eb | |
parent | 70e45db3cfcf01b3b36fe619b03cf604e6666c91 (diff) | |
download | pki-6cd64781a7cda192bc2b0a555974037fd16cc2c5.tar.gz pki-6cd64781a7cda192bc2b0a555974037fd16cc2c5.tar.xz pki-6cd64781a7cda192bc2b0a555974037fd16cc2c5.zip |
Misc Fixes Remaining part of the code.
24 files changed, 69 insertions, 103 deletions
diff --git a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index 84afb8474..8020a6562 100644 --- a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -202,6 +202,7 @@ public class CMSEngine implements ICMSEngine { private ISecurityDomainSessionTable mSecurityDomainSessionTable = null; private String mConfigSDSessionId = null; private Timer mSDTimer = null; + private String mServerCertNickname = null; // static subsystems - must be singletons private static SubsystemInfo[] mStaticSubsystems = { @@ -249,7 +250,6 @@ public class CMSEngine implements ICMSEngine { private static final int EE_SSL = 2; private static final int EE_NON_SSL = 3; private static final int EE_CLIENT_AUTH_SSL = 4; - private static String mServerCertNickname = null; private static String info[][] = { { null, null, null },//agent { null, null, null },//admin { null, null, null },//sslEE diff --git a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java index c1ec27a8c..2fa319ffc 100644 --- a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java +++ b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java @@ -365,7 +365,7 @@ public class SimpleProperties extends Hashtable<String, String> { * @return the value in this property list with the specified key value. * @see java.util.Properties#defaults */ - public String getProperty(String key, String defaultValue) { + public synchronized String getProperty(String key, String defaultValue) { String val = getProperty(key); return (val == null) ? defaultValue : val; diff --git a/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java b/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java index 30f806ea2..c39db40d0 100644 --- a/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java +++ b/base/common/src/com/netscape/cmscore/cert/CertDateCompare.java @@ -28,7 +28,10 @@ import netscape.security.x509.X509CertImpl; * @author kanda * @version $Revision$, $Date$ */ -public class CertDateCompare implements Comparator<X509CertImpl> { +public class CertDateCompare implements Comparator<X509CertImpl>, java.io.Serializable { + + private static final long serialVersionUID = -1784015027375808580L; + public CertDateCompare() { } diff --git a/base/common/src/com/netscape/cmscore/cert/CertUtils.java b/base/common/src/com/netscape/cmscore/cert/CertUtils.java index b7942e5a1..37444eff5 100644 --- a/base/common/src/com/netscape/cmscore/cert/CertUtils.java +++ b/base/common/src/com/netscape/cmscore/cert/CertUtils.java @@ -842,7 +842,7 @@ public class CertUtils { return false; } - if (certusage == "") + if (certusage == null || certusage.equals("")) CMS.debug("CertUtils: verifySystemCertByNickname(): required certusage not defined, getting current certusage"); CMS.debug("CertUtils: verifySystemCertByNickname(): calling isCertValid()"); try { diff --git a/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java b/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java index c5e3312e1..a55a186e3 100644 --- a/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java +++ b/base/common/src/com/netscape/cmscore/connector/HttpConnFactory.java @@ -296,8 +296,4 @@ public class HttpConnFactory { "In Http (bound) connection pool to" + msg); } - - protected void finalize() - throws Exception { - } -} +}
\ No newline at end of file diff --git a/base/common/src/com/netscape/cmscore/connector/LocalConnector.java b/base/common/src/com/netscape/cmscore/connector/LocalConnector.java index ed0d5aa6d..c4eb78625 100644 --- a/base/common/src/com/netscape/cmscore/connector/LocalConnector.java +++ b/base/common/src/com/netscape/cmscore/connector/LocalConnector.java @@ -183,7 +183,7 @@ public class LocalConnector implements IConnector { // are persistent before the servicing. // Please see stateEngine() function in // ARequestQueue.java for details. - r = mSourceReqs.get(rId); + r = mSourceReqs.get(rId.toString()); if (r != null) { if (r.getRequestStatus() != RequestStatus.SVC_PENDING) { mSource.log(ILogger.LL_FAILURE, diff --git a/base/common/src/com/netscape/cmscore/security/PWsdrCache.java b/base/common/src/com/netscape/cmscore/security/PWsdrCache.java index e9c7af8e5..d723d55ed 100644 --- a/base/common/src/com/netscape/cmscore/security/PWsdrCache.java +++ b/base/common/src/com/netscape/cmscore/security/PWsdrCache.java @@ -128,7 +128,6 @@ public class PWsdrCache { cm = CryptoManager.getInstance(); if (mTokenName != null) { mToken = cm.getTokenByName(mTokenName); - mToken = cm.getInternalKeyStorageToken(); debug("PWsdrCache: mToken = " + mTokenName); } else { mToken = cm.getInternalKeyStorageToken(); diff --git a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java index 50db485a4..7bbba8797 100644 --- a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java +++ b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java @@ -166,9 +166,10 @@ public class CMCResponse { (OCTET_STRING) (ASN1Util.decode(OCTET_STRING.getTemplate(), ASN1Util.encode(recipientN.elementAt(0)))); byte b[] = str.toByteArray(); - String s = " Value: "; + StringBuilder s = new StringBuilder(" Value: "); for (int m = 0; m < b.length; m++) { - s = s + b[m] + " "; + s.append(b[m]); + s.append(" "); } System.out.println(s); } else if (type.equals(OBJECT_IDENTIFIER.id_cmc_senderNonce)) { @@ -179,9 +180,10 @@ public class CMCResponse { (OCTET_STRING) (ASN1Util.decode(OCTET_STRING.getTemplate(), ASN1Util.encode(senderN.elementAt(0)))); byte b[] = str.toByteArray(); - String s = " Value: "; + StringBuilder s = new StringBuilder(" Value: "); for (int m = 0; m < b.length; m++) { - s = s + b[m] + " "; + s.append(b[m]); + s.append(" "); } System.out.println(s); } else if (type.equals(OBJECT_IDENTIFIER.id_cmc_dataReturn)) { @@ -192,9 +194,10 @@ public class CMCResponse { (OCTET_STRING) (ASN1Util.decode(OCTET_STRING.getTemplate(), ASN1Util.encode(dataReturn.elementAt(0)))); byte b[] = str.toByteArray(); - String s = " Value: "; + StringBuilder s = new StringBuilder(" Value: "); for (int m = 0; m < b.length; m++) { - s = s + b[m] + " "; + s.append(b[m]); + s.append(" "); } System.out.println(s); } diff --git a/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java index 8aebebad0..4ba69ef9c 100644 --- a/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java +++ b/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java @@ -420,7 +420,7 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove /** * Clears up system during garbage collection. */ - public void finalize() { + protected void finalize() { shutdown(); } diff --git a/base/util/src/netscape/security/pkcs/PKCS10Attribute.java b/base/util/src/netscape/security/pkcs/PKCS10Attribute.java index 3a2c7b437..c84df2a37 100644 --- a/base/util/src/netscape/security/pkcs/PKCS10Attribute.java +++ b/base/util/src/netscape/security/pkcs/PKCS10Attribute.java @@ -61,9 +61,6 @@ import netscape.security.x509.OIDMap; * @version 1.13 */ public class PKCS10Attribute implements DerEncoder, Serializable { - /** - * - */ private static final long serialVersionUID = 2002480042340316170L; protected ObjectIdentifier attributeId = null; protected CertAttrSet attributeValue = null; diff --git a/base/util/src/netscape/security/util/ByteArrayLexOrder.java b/base/util/src/netscape/security/util/ByteArrayLexOrder.java index 48954850e..2780e527a 100644 --- a/base/util/src/netscape/security/util/ByteArrayLexOrder.java +++ b/base/util/src/netscape/security/util/ByteArrayLexOrder.java @@ -25,7 +25,9 @@ import java.util.Comparator; * @version 1.4 97/12/10 * @author D. N. Hoover */ -public class ByteArrayLexOrder implements Comparator<byte[]> { +public class ByteArrayLexOrder implements Comparator<byte[]>, java.io.Serializable { + + private static final long serialVersionUID = 1897537410212918669L; /** * Perform lexicographical comparison of two byte arrays, diff --git a/base/util/src/netscape/security/util/ByteArrayTagOrder.java b/base/util/src/netscape/security/util/ByteArrayTagOrder.java index 40a627627..267a12eb7 100644 --- a/base/util/src/netscape/security/util/ByteArrayTagOrder.java +++ b/base/util/src/netscape/security/util/ByteArrayTagOrder.java @@ -19,7 +19,9 @@ package netscape.security.util; import java.util.Comparator; -public class ByteArrayTagOrder implements Comparator<byte[]> { +public class ByteArrayTagOrder implements Comparator<byte[]>, java.io.Serializable { + + private static final long serialVersionUID = -2027007556858126443L; /** * Compare two byte arrays, by the order of their tags, diff --git a/base/util/src/netscape/security/x509/AlgIdDSA.java b/base/util/src/netscape/security/x509/AlgIdDSA.java index 1f00b0355..ed2a73de0 100644 --- a/base/util/src/netscape/security/x509/AlgIdDSA.java +++ b/base/util/src/netscape/security/x509/AlgIdDSA.java @@ -186,33 +186,29 @@ public final class AlgIdDSA extends AlgorithmId implements DSAParams { } @Override - public boolean equals(Object other) { - if (other == null) { + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) return false; - } - if (other instanceof AlgIdDSA) { - AlgIdDSA rhs = (AlgIdDSA) other; - if (this == rhs) { - return true; - } - if (!(bigIntEquals(this.p, rhs.p) && bigIntEquals(this.q, rhs.q) && bigIntEquals(this.g, rhs.g))) { + if (getClass() != obj.getClass()) + return false; + AlgIdDSA other = (AlgIdDSA) obj; + if (g == null) { + if (other.g != null) return false; - } - return super.equals(rhs); - } - return false; - } - - public boolean bigIntEquals(BigInteger x, BigInteger y) { - if (x == null) { - if (y != null) { + } else if (!g.equals(other.g)) + return false; + if (p == null) { + if (other.p != null) return false; - } - } else { - if (!x.equals(y)) { + } else if (!p.equals(other.p)) + return false; + if (q == null) { + if (other.q != null) return false; - } - } + } else if (!q.equals(other.q)) + return false; return true; } diff --git a/base/util/src/netscape/security/x509/CertificateAlgorithmId.java b/base/util/src/netscape/security/x509/CertificateAlgorithmId.java index b1b14f42b..8e669b8f9 100644 --- a/base/util/src/netscape/security/x509/CertificateAlgorithmId.java +++ b/base/util/src/netscape/security/x509/CertificateAlgorithmId.java @@ -97,13 +97,11 @@ public class CertificateAlgorithmId implements CertAttrSet, Serializable { ", OID = " + (algId.getOID()).toString() + "\n"); } - private synchronized void writeObject(ObjectOutputStream stream) - throws IOException { + private void writeObject(ObjectOutputStream stream) throws IOException { encode(stream); } - private synchronized void readObject(ObjectInputStream stream) - throws IOException { + private void readObject(ObjectInputStream stream) throws IOException { decode(stream); } diff --git a/base/util/src/netscape/security/x509/CertificateExtensions.java b/base/util/src/netscape/security/x509/CertificateExtensions.java index 93be196ab..5fdac2824 100644 --- a/base/util/src/netscape/security/x509/CertificateExtensions.java +++ b/base/util/src/netscape/security/x509/CertificateExtensions.java @@ -170,13 +170,11 @@ public class CertificateExtensions extends Vector<Extension> } } - private synchronized void writeObject(ObjectOutputStream stream) - throws CertificateException, IOException { + private void writeObject(ObjectOutputStream stream) throws CertificateException, IOException { encode(stream); } - private synchronized void readObject(ObjectInputStream stream) - throws CertificateException, IOException { + private void readObject(ObjectInputStream stream) throws CertificateException, IOException { decodeEx(stream); } diff --git a/base/util/src/netscape/security/x509/CertificateSubjectName.java b/base/util/src/netscape/security/x509/CertificateSubjectName.java index 0f4ed7d61..f8dfe41f8 100644 --- a/base/util/src/netscape/security/x509/CertificateSubjectName.java +++ b/base/util/src/netscape/security/x509/CertificateSubjectName.java @@ -96,13 +96,11 @@ public class CertificateSubjectName implements CertAttrSet, Serializable { return (dnName.toString()); } - private synchronized void writeObject(ObjectOutputStream stream) - throws IOException { + private void writeObject(ObjectOutputStream stream) throws IOException { encode(stream); } - private synchronized void readObject(ObjectInputStream stream) - throws IOException { + private void readObject(ObjectInputStream stream) throws IOException { decodeEx(stream); } diff --git a/base/util/src/netscape/security/x509/CertificateValidity.java b/base/util/src/netscape/security/x509/CertificateValidity.java index 511f1b1eb..ae24979c5 100644 --- a/base/util/src/netscape/security/x509/CertificateValidity.java +++ b/base/util/src/netscape/security/x509/CertificateValidity.java @@ -42,9 +42,7 @@ import netscape.security.util.DerValue; * @see CertAttrSet */ public class CertificateValidity implements CertAttrSet, Serializable { - /** - * - */ + private static final long serialVersionUID = 8277703278213804194L; /** * Identifier for this attribute, to be used with the @@ -156,13 +154,11 @@ public class CertificateValidity implements CertAttrSet, Serializable { construct(derVal); } - private synchronized void writeObject(ObjectOutputStream stream) - throws IOException { + private void writeObject(ObjectOutputStream stream) throws IOException { encode(stream); } - private synchronized void readObject(ObjectInputStream stream) - throws IOException { + private void readObject(ObjectInputStream stream) throws IOException { decode(stream); } diff --git a/base/util/src/netscape/security/x509/CertificateX509Key.java b/base/util/src/netscape/security/x509/CertificateX509Key.java index a77a1e7dd..0b6f250d9 100644 --- a/base/util/src/netscape/security/x509/CertificateX509Key.java +++ b/base/util/src/netscape/security/x509/CertificateX509Key.java @@ -108,13 +108,11 @@ public class CertificateX509Key implements CertAttrSet, Serializable { key = X509Key.parse(val); } - private synchronized void writeObject(ObjectOutputStream stream) - throws IOException { + private void writeObject(ObjectOutputStream stream) throws IOException { encode(stream); } - private synchronized void readObject(ObjectInputStream stream) - throws IOException { + private void readObject(ObjectInputStream stream) throws IOException { decode(stream); } @@ -142,7 +140,7 @@ public class CertificateX509Key implements CertAttrSet, Serializable { this.key = (X509Key) obj; } else { throw new IOException("Attribute name not recognized by " + - "CertAttrSet: CertificateX509Key."); + "CertAttrSet: CertificateX509Key."); } } @@ -154,7 +152,7 @@ public class CertificateX509Key implements CertAttrSet, Serializable { return (key); } else { throw new IOException("Attribute name not recognized by " + - "CertAttrSet: CertificateX509Key."); + "CertAttrSet: CertificateX509Key."); } } @@ -166,7 +164,7 @@ public class CertificateX509Key implements CertAttrSet, Serializable { key = null; } else { throw new IOException("Attribute name not recognized by " + - "CertAttrSet: CertificateX509Key."); + "CertAttrSet: CertificateX509Key."); } } diff --git a/base/util/src/netscape/security/x509/Extension.java b/base/util/src/netscape/security/x509/Extension.java index 8d575606a..c7b0aa887 100644 --- a/base/util/src/netscape/security/x509/Extension.java +++ b/base/util/src/netscape/security/x509/Extension.java @@ -51,9 +51,6 @@ import netscape.security.util.ObjectIdentifier; * @version 1.9 */ public class Extension implements Serializable { - /** - * - */ private static final long serialVersionUID = -643549610716024753L; protected ObjectIdentifier extensionId = null; protected boolean critical = false; diff --git a/base/util/src/netscape/security/x509/RevokedCertImpl.java b/base/util/src/netscape/security/x509/RevokedCertImpl.java index df3bc37a8..eac11f8e3 100755 --- a/base/util/src/netscape/security/x509/RevokedCertImpl.java +++ b/base/util/src/netscape/security/x509/RevokedCertImpl.java @@ -432,8 +432,7 @@ public class RevokedCertImpl extends RevokedCertificate implements Serializable * they're parsed when they get read back. (Actually they serialize as some * type data from the serialization subsystem, then the cert data.) */ - private synchronized void writeObject(ObjectOutputStream stream) - throws CRLException, X509ExtensionException, IOException { + private void writeObject(ObjectOutputStream stream) throws CRLException, X509ExtensionException, IOException { DerOutputStream dos = new DerOutputStream(); encode(dos); dos.derEncode(stream); @@ -443,8 +442,7 @@ public class RevokedCertImpl extends RevokedCertificate implements Serializable * Serialization read ... X.509 certificates serialize as themselves, and * they're parsed when they get read back. */ - private synchronized void readObject(ObjectInputStream stream) - throws CRLException, X509ExtensionException, IOException { + private void readObject(ObjectInputStream stream) throws CRLException, X509ExtensionException, IOException { decode(stream); } diff --git a/base/util/src/netscape/security/x509/X509Cert.java b/base/util/src/netscape/security/x509/X509Cert.java index ea1e26deb..021cae207 100644 --- a/base/util/src/netscape/security/x509/X509Cert.java +++ b/base/util/src/netscape/security/x509/X509Cert.java @@ -831,9 +831,7 @@ public class X509Cert implements Certificate, Serializable { * (Actually they serialize as some type data from the * serialization subsystem, then the cert data.) */ - private synchronized void - writeObject(java.io.ObjectOutputStream stream) - throws IOException { + private void writeObject(java.io.ObjectOutputStream stream) throws IOException { encode(stream); } @@ -841,9 +839,7 @@ public class X509Cert implements Certificate, Serializable { * Serialization read ... X.509 certificates serialize as * themselves, and they're parsed when they get read back. */ - private synchronized void - readObject(ObjectInputStream stream) - throws IOException { + private void readObject(ObjectInputStream stream) throws IOException { decode(stream); } } diff --git a/base/util/src/netscape/security/x509/X509CertImpl.java b/base/util/src/netscape/security/x509/X509CertImpl.java index b6d97da38..2d24b6659 100755 --- a/base/util/src/netscape/security/x509/X509CertImpl.java +++ b/base/util/src/netscape/security/x509/X509CertImpl.java @@ -1149,8 +1149,7 @@ public class X509CertImpl extends X509Certificate * (Actually they serialize as some type data from the * serialization subsystem, then the cert data.) */ - private synchronized void writeObject(ObjectOutputStream stream) - throws CertificateException, IOException { + private void writeObject(ObjectOutputStream stream) throws CertificateException, IOException { encode(stream); } @@ -1158,8 +1157,7 @@ public class X509CertImpl extends X509Certificate * Serialization read ... X.509 certificates serialize as * themselves, and they're parsed when they get read back. */ - private synchronized void readObject(ObjectInputStream stream) - throws CertificateException, IOException { + private void readObject(ObjectInputStream stream) throws CertificateException, IOException { decode(stream); } diff --git a/base/util/src/netscape/security/x509/X509CertInfo.java b/base/util/src/netscape/security/x509/X509CertInfo.java index 6ad4d243f..2ad17ebc0 100644 --- a/base/util/src/netscape/security/x509/X509CertInfo.java +++ b/base/util/src/netscape/security/x509/X509CertInfo.java @@ -796,8 +796,7 @@ public class X509CertInfo implements CertAttrSet, Serializable { * (Actually they serialize as some type data from the * serialization subsystem, then the cert data.) */ - private synchronized void writeObject(ObjectOutputStream stream) - throws CertificateException, IOException { + private void writeObject(ObjectOutputStream stream) throws CertificateException, IOException { encode(stream); } @@ -805,8 +804,7 @@ public class X509CertInfo implements CertAttrSet, Serializable { * Serialization read ... X.509 certificates serialize as * themselves, and they're parsed when they get read back. */ - private synchronized void readObject(ObjectInputStream stream) - throws CertificateException, IOException { + private void readObject(ObjectInputStream stream) throws CertificateException, IOException { decode(stream); } diff --git a/base/util/src/netscape/security/x509/X509Key.java b/base/util/src/netscape/security/x509/X509Key.java index 5c8ac3a88..7af1036ea 100644 --- a/base/util/src/netscape/security/x509/X509Key.java +++ b/base/util/src/netscape/security/x509/X509Key.java @@ -354,9 +354,7 @@ public class X509Key implements PublicKey { * Serialization write ... X.509 keys serialize as * themselves, and they're parsed when they get read back. */ - private synchronized void - writeObject(java.io.ObjectOutputStream stream) - throws IOException { + private void writeObject(java.io.ObjectOutputStream stream) throws IOException { stream.write(getEncoded()); } @@ -364,17 +362,12 @@ public class X509Key implements PublicKey { * Serialization read ... X.509 keys serialize as * themselves, and they're parsed when they get read back. */ - private synchronized void - readObject(ObjectInputStream stream) - throws IOException { - + private void readObject(ObjectInputStream stream) throws IOException { try { decode(stream); - } catch (InvalidKeyException e) { e.printStackTrace(); - throw new IOException("deserialized key is invalid: " + - e.getMessage()); + throw new IOException("deserialized key is invalid: " + e.getMessage()); } } |