From 6cd64781a7cda192bc2b0a555974037fd16cc2c5 Mon Sep 17 00:00:00 2001 From: Abhishek Koneru Date: Wed, 11 Jul 2012 14:54:32 -0400 Subject: Misc Fixes Remaining part of the code. --- .../netscape/security/pkcs/PKCS10Attribute.java | 3 -- .../netscape/security/util/ByteArrayLexOrder.java | 4 ++- .../netscape/security/util/ByteArrayTagOrder.java | 4 ++- base/util/src/netscape/security/x509/AlgIdDSA.java | 42 ++++++++++------------ .../security/x509/CertificateAlgorithmId.java | 6 ++-- .../security/x509/CertificateExtensions.java | 6 ++-- .../security/x509/CertificateSubjectName.java | 6 ++-- .../security/x509/CertificateValidity.java | 10 ++---- .../netscape/security/x509/CertificateX509Key.java | 12 +++---- .../util/src/netscape/security/x509/Extension.java | 3 -- .../netscape/security/x509/RevokedCertImpl.java | 6 ++-- base/util/src/netscape/security/x509/X509Cert.java | 8 ++--- .../src/netscape/security/x509/X509CertImpl.java | 6 ++-- .../src/netscape/security/x509/X509CertInfo.java | 6 ++-- base/util/src/netscape/security/x509/X509Key.java | 13 ++----- 15 files changed, 50 insertions(+), 85 deletions(-) (limited to 'base/util/src') 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 { +public class ByteArrayLexOrder implements Comparator, 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 { +public class ByteArrayTagOrder implements Comparator, 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 } } - 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()); } } -- cgit