diff options
7 files changed, 19 insertions, 30 deletions
diff --git a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java index f8a5cf4d0..fb399e0c6 100644 --- a/base/common/src/com/netscape/cmscore/base/SimpleProperties.java +++ b/base/common/src/com/netscape/cmscore/base/SimpleProperties.java @@ -348,9 +348,8 @@ public class SimpleProperties extends Hashtable<String, String> { */ public String getProperty(String key) { String oval = super.get(key); - String sval = (oval instanceof String) ? oval : null; - return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; + return ((oval == null) && (defaults != null)) ? defaults.getProperty(key) : oval; } /** diff --git a/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java b/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java index c9180630f..79131244a 100644 --- a/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java +++ b/base/common/src/com/netscape/cmscore/ldap/LdapRequestListener.java @@ -271,8 +271,7 @@ class LdapRenewalListener implements IRequestListener { return; } - if (certs[0] instanceof X509CertImpl) - acceptX509(r, certs); + acceptX509(r, certs); } public void acceptX509(IRequest r, Certificate[] certs) { @@ -333,8 +332,7 @@ class LdapRevocationListener implements IRequestListener { return; } - if (certs[0] instanceof X509CertImpl) - acceptX509(r, certs); + acceptX509(r, certs); } public void acceptX509(IRequest r, Certificate[] revcerts) { @@ -445,8 +443,7 @@ class LdapUnrevocationListener implements IRequestListener { return; } - if (certs[0] instanceof X509CertImpl) - acceptX509(r, certs); + acceptX509(r, certs); } public void acceptX509(IRequest r, Certificate[] certs) { diff --git a/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java b/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java index baf86da31..d717d9732 100644 --- a/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java +++ b/base/common/src/com/netscape/cmscore/policy/GenericPolicyProcessor.java @@ -316,8 +316,7 @@ public class GenericPolicyProcessor implements IPolicyProcessor { try { rule = (IPolicyRule) Class.forName(classpath).newInstance(); - if (rule instanceof IPolicyRule) - rule.setInstanceName(instanceName); + rule.setInstanceName(instanceName); rule.init(this, c); } catch (Throwable e) { mAuthority.log(ILogger.LL_FAILURE, diff --git a/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java index 44197b406..b7bd43793 100644 --- a/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java +++ b/base/common/src/com/netscape/cmscore/request/ExtDataHashtable.java @@ -53,11 +53,7 @@ public class ExtDataHashtable<V> extends Hashtable<String, V> { } public V put(String oKey, V val) { - if (oKey instanceof String) { - String key = oKey; - return super.put(key.toLowerCase(), val); - } - return super.put(oKey, val); + return super.put(oKey.toLowerCase(), val); } public void putAll(Map<? extends String, ? extends V> map) { diff --git a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java index cec1ea434..a2c6fd9f5 100644 --- a/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java +++ b/base/kra/src/com/netscape/kra/SecurityDataRecoveryService.java @@ -50,16 +50,16 @@ import org.mozilla.jss.pkix.primitive.AlgorithmIdentifier; import org.mozilla.jss.pkix.primitive.PBEParameter; import org.mozilla.jss.util.Password; +import com.netscape.certsrv.apps.CMS; +import com.netscape.certsrv.base.EBaseException; +import com.netscape.certsrv.dbs.keydb.IKeyRecord; +import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.certsrv.kra.EKRAException; import com.netscape.certsrv.kra.IKeyRecoveryAuthority; -import com.netscape.certsrv.request.IService; import com.netscape.certsrv.request.IRequest; +import com.netscape.certsrv.request.IService; import com.netscape.certsrv.security.IStorageKeyUnit; import com.netscape.certsrv.security.ITransportKeyUnit; -import com.netscape.certsrv.apps.CMS; -import com.netscape.certsrv.base.EBaseException; -import com.netscape.certsrv.dbs.keydb.IKeyRecord; -import com.netscape.certsrv.dbs.keydb.IKeyRepository; import com.netscape.cms.servlet.request.KeyRequestResource; import com.netscape.cmscore.dbs.KeyRecord; import com.netscape.cmsutil.util.Utils; @@ -301,9 +301,8 @@ public class SecurityDataRecoveryService implements IService { InvalidKeyException, InvalidAlgorithmParameterException, TokenException, CharConversionException { - if (!(keyGenAlg instanceof PBEAlgorithm)) { - throw new NoSuchAlgorithmException("Key generation algorithm" + - " is not a PBE algorithm"); + if (keyGenAlg == null) { + throw new NoSuchAlgorithmException("Key generation algorithm is NULL"); } PBEAlgorithm pbeAlg = keyGenAlg; diff --git a/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java b/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java index e0f2d4516..241d13f06 100644 --- a/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java +++ b/base/silent/src/com/netscape/pkisilent/common/CMSProperties.java @@ -553,11 +553,10 @@ class CMSProperties extends Hashtable<String, String> { */ public String getProperty(String key) { String oval = super.get(key); - String sval = (oval instanceof String) ? oval : null; - return ((sval == null) && (defaults != null)) + return ((oval == null) && (defaults != null)) ? defaults.getProperty(key) - : sval; + : oval; } /** diff --git a/base/util/src/netscape/security/x509/X509Cert.java b/base/util/src/netscape/security/x509/X509Cert.java index 9162cc92f..ea1e26deb 100644 --- a/base/util/src/netscape/security/x509/X509Cert.java +++ b/base/util/src/netscape/security/x509/X509Cert.java @@ -159,9 +159,9 @@ public class X509Cert implements Certificate, Serializable { Date notAfter) throws CertException { subject = subjectName; - if (!(subjectPublicKey instanceof PublicKey)) + if (subjectPublicKey == null) throw new CertException(CertException.err_INVALID_PUBLIC_KEY, - "Doesn't implement PublicKey interface"); + "Public Key is NULL"); /* * The X509 cert API requires X509 keys, else things break. @@ -402,11 +402,11 @@ public class X509Cert implements Certificate, Serializable { String algorithm; Signature sig; - if (privateKey instanceof Key) { + if (privateKey != null) { Key key = privateKey; algorithm = key.getAlgorithm(); } else { - throw new InvalidKeyException("private key not a key!"); + throw new InvalidKeyException("Private Key is NULL"); } sig = Signature.getInstance(algorithmId.getName()); |