diff options
9 files changed, 17 insertions, 27 deletions
diff --git a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java index 2fa319ffc..38c17d861 100644 --- a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java +++ b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java @@ -347,7 +347,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) { + public synchronized String getProperty(String key) { String oval = super.get(key); return ((oval == null) && (defaults != null)) ? defaults.getProperty(key) : oval; diff --git a/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java b/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java index 699877ffa..8d98f21b7 100644 --- a/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java +++ b/base/common/src/com/netscape/cmscore/ldap/LdapPredicateParser.java @@ -260,7 +260,6 @@ public class LdapPredicateParser { class PredicateTokenizer { String input; int currentIndex; - int endOfString; String nextToken; public PredicateTokenizer(String predString) { diff --git a/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java b/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java index 849417869..c55b84ece 100644 --- a/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java +++ b/base/common/src/com/netscape/cmscore/policy/PolicyPredicateParser.java @@ -263,7 +263,6 @@ public class PolicyPredicateParser { class PredicateTokenizer { String input; int currentIndex; - int endOfString; String nextToken; public PredicateTokenizer(String predString) { diff --git a/base/common/src/com/netscape/cmscore/security/CASigningCert.java b/base/common/src/com/netscape/cmscore/security/CASigningCert.java index 8d35acf1b..701ac4c18 100644 --- a/base/common/src/com/netscape/cmscore/security/CASigningCert.java +++ b/base/common/src/com/netscape/cmscore/security/CASigningCert.java @@ -91,8 +91,7 @@ public class CASigningCert extends CertificateInfo { } // get PQG params from the configuration file - public static PQGParams getPQGParams() throws EBaseException, IOException, - PQGParamGenException { + public PQGParams getPQGParams() throws EBaseException, IOException, PQGParamGenException { byte[] p = mConfig.getByteArray("ca.dsaP", null); byte[] q = mConfig.getByteArray("ca.dsaQ", null); diff --git a/base/common/src/com/netscape/cmscore/security/CertificateInfo.java b/base/common/src/com/netscape/cmscore/security/CertificateInfo.java index c4d776934..58eb9ae63 100644 --- a/base/common/src/com/netscape/cmscore/security/CertificateInfo.java +++ b/base/common/src/com/netscape/cmscore/security/CertificateInfo.java @@ -70,7 +70,7 @@ public abstract class CertificateInfo { protected KeyCertData mProperties; protected KeyPair mKeyPair; - protected static IConfigStore mConfig; + protected IConfigStore mConfig; public CertificateInfo(KeyCertData properties) { this(properties, null); diff --git a/base/common/src/com/netscape/cmscore/security/OCSPSigningCert.java b/base/common/src/com/netscape/cmscore/security/OCSPSigningCert.java index 07ae9ee2f..08cdd92e8 100644 --- a/base/common/src/com/netscape/cmscore/security/OCSPSigningCert.java +++ b/base/common/src/com/netscape/cmscore/security/OCSPSigningCert.java @@ -69,8 +69,7 @@ public class OCSPSigningCert extends CertificateInfo { } // get PQG params from the configuration file - public static PQGParams getPQGParams() throws EBaseException, IOException, - PQGParamGenException { + public PQGParams getPQGParams() throws EBaseException, IOException, PQGParamGenException { byte[] p = mConfig.getByteArray("ca.dsaP", null); byte[] q = mConfig.getByteArray("ca.dsaQ", null); diff --git a/base/kra/src/com/netscape/kra/StorageKeyUnit.java b/base/kra/src/com/netscape/kra/StorageKeyUnit.java index 6ef3d7d16..387e20bf7 100644 --- a/base/kra/src/com/netscape/kra/StorageKeyUnit.java +++ b/base/kra/src/com/netscape/kra/StorageKeyUnit.java @@ -168,23 +168,29 @@ public class StorageKeyUnit extends EncryptionUnit implements if (mKeySplitting) { byte certFileData[] = null; + FileInputStream fi = null; try { File certFile = new File( mConfig.getString(PROP_CERTDB)); certFileData = new byte[ (Long.valueOf(certFile.length())).intValue()]; - FileInputStream fi = new FileInputStream(certFile); + fi = new FileInputStream(certFile); fi.read(certFileData); - fi.close(); - // pick up cert by nickName } catch (IOException e) { mKRA.log(ILogger.LL_INFO, CMS.getLogMessage("CMSCORE_KRA_STORAGE_READ_CERT", e.toString())); throw new EBaseException(CMS.getUserMessage("CMS_BASE_CERT_ERROR", e.toString())); + } finally { + try { + if (fi != null) + fi.close(); + } catch (IOException e) { + e.printStackTrace(); + } } try { diff --git a/base/util/src/netscape/security/pkcs/PKCS8Key.java b/base/util/src/netscape/security/pkcs/PKCS8Key.java index db1d6b275..8806cd3fb 100644 --- a/base/util/src/netscape/security/pkcs/PKCS8Key.java +++ b/base/util/src/netscape/security/pkcs/PKCS8Key.java @@ -331,9 +331,7 @@ public class PKCS8Key implements PrivateKey { * Serialization write ... PKCS#8 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()); } @@ -341,12 +339,9 @@ public class PKCS8Key implements PrivateKey { * Serialization read ... PKCS#8 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: " + diff --git a/base/util/src/netscape/security/x509/CRLDistributionPoint.java b/base/util/src/netscape/security/x509/CRLDistributionPoint.java index 637ee57fe..7c591aee5 100644 --- a/base/util/src/netscape/security/x509/CRLDistributionPoint.java +++ b/base/util/src/netscape/security/x509/CRLDistributionPoint.java @@ -251,7 +251,7 @@ public class CRLDistributionPoint implements ASN1Value { return templateInstance; } - public static void main(String args[]) throws Exception { + public static void main(String args[]) throws GeneralNamesException, IOException, InvalidBERException { ByteArrayOutputStream bos = null; FileOutputStream fos = null; try { @@ -337,9 +337,6 @@ public class CRLDistributionPoint implements ASN1Value { } System.out.println("Done"); - } catch (Exception e) { - e.printStackTrace(); - throw e; } finally { if (bos != null) { bos.close(); @@ -348,11 +345,7 @@ public class CRLDistributionPoint implements ASN1Value { fos.close(); } if (fos != null) { - try { - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } + fos.close(); } } } |