diff options
author | Abhishek Koneru <akoneru@redhat.com> | 2012-05-24 16:11:53 -0400 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-06-01 09:35:27 -0400 |
commit | 2588e04ce15d8ce932900cb7b5d75e894082db46 (patch) | |
tree | 43776fbb3fb8b9a5656d3fdee1b2da90526a0eeb | |
parent | b6967b3b2b850e4158bd1fb6cee418e714053e30 (diff) | |
download | pki-2588e04ce15d8ce932900cb7b5d75e894082db46.tar.gz pki-2588e04ce15d8ce932900cb7b5d75e894082db46.tar.xz pki-2588e04ce15d8ce932900cb7b5d75e894082db46.zip |
Fixes for Coverity Issues CALL_SUPER,UNCONFIRMEDCAST,DEAD_STORE,TOSTRING_ARRAY
22 files changed, 38 insertions, 23 deletions
diff --git a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java index ba3d9f293..f8f7588a7 100644 --- a/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java +++ b/base/common/src/com/netscape/certsrv/request/ARequestNotifier.java @@ -91,13 +91,13 @@ public class ARequestNotifier implements IRequestNotifier { mRequestQueue = mCA.getRequestQueue(); if (mIsPublishingQueueEnabled && mSavePublishingStatus > 0 && mRequestQueue != null) { mPublishingStatus = mRequestQueue.getPublishingStatus(); - BigInteger status = new BigInteger("-2"); try { - status = new BigInteger(mPublishingStatus); + BigInteger status = new BigInteger(mPublishingStatus); if (status.compareTo(BigInteger.ZERO) > -1) { recoverPublishingQueue(mPublishingStatus); } } catch (Exception e) { + e.printStackTrace(); } } diff --git a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java index 4eacf2236..855073916 100644 --- a/base/common/src/com/netscape/cmscore/apps/CMSEngine.java +++ b/base/common/src/com/netscape/cmscore/apps/CMSEngine.java @@ -896,7 +896,6 @@ public class CMSEngine implements ICMSEngine { // load dyn subsystems. mDynSubsystems = new SubsystemInfo[nsubsystems]; - ssnames = ssconfig.getSubStoreNames(); for (int i = 0; i < mDynSubsystems.length; i++) { IConfigStore config = ssconfig.getSubStore(String.valueOf(i)); diff --git a/base/common/src/com/netscape/cmscore/connector/Resender.java b/base/common/src/com/netscape/cmscore/connector/Resender.java index e1b19749a..73a399fdc 100644 --- a/base/common/src/com/netscape/cmscore/connector/Resender.java +++ b/base/common/src/com/netscape/cmscore/connector/Resender.java @@ -216,11 +216,9 @@ public class Resender implements IResender { RequestStatus replyStatus = RequestStatus.fromString(replymsg.reqStatus); int index = replymsg.reqId.lastIndexOf(':'); - RequestId replyRequestId = - new RequestId(replymsg.reqId.substring(index + 1)); if (Debug.ON) - Debug.trace("reply request id " + replyRequestId + + Debug.trace("reply request id " + replymsg.reqId.substring(index + 1) + " for request " + r.getRequestId()); if (replyStatus != RequestStatus.COMPLETE) { diff --git a/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java b/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java index 1edee3812..79f2e91c4 100644 --- a/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java +++ b/base/common/src/com/netscape/cmscore/ldapconn/LdapAnonConnFactory.java @@ -338,8 +338,15 @@ public class LdapAnonConnFactory implements ILdapConnFactory { if (conn == null) { return; } + AnonConnection anon = null; + // check if conn is valid and from this factory. - AnonConnection anon = (AnonConnection) conn; + if (conn instanceof AnonConnection) { + anon = (AnonConnection) conn; + } else { + log(ILogger.LL_WARN, "returnConn : Connection is not an AnonConnection"); + return; + } if (anon.getFacId() != mConns) { // returning a connection not from this factory. diff --git a/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java b/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java index 1da965a3a..c3e84f136 100644 --- a/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java +++ b/base/common/src/com/netscape/cmscore/ldapconn/LdapBoundConnFactory.java @@ -413,7 +413,14 @@ public class LdapBoundConnFactory implements ILdapBoundConnFactory { if (conn == null) { return; } - BoundConnection boundconn = (BoundConnection) conn; + BoundConnection boundconn = null; + + if (conn instanceof BoundConnection) { + boundconn = (BoundConnection) conn; + } else { + log(ILogger.LL_WARN, "returnConn : Connection is not an BoundConnection"); + return; + } if (boundconn.getFacId() != mConns) { log(ILogger.LL_WARN, "returnConn: unknown connection."); diff --git a/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java index 0ae6af0c3..6f5d29730 100644 --- a/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java +++ b/base/common/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java @@ -1249,9 +1249,7 @@ public class SelfTestSubsystem throws EBaseException { // strip preceding/trailing whitespace // from passed-in String parameters - if (id != null) { - id = id.trim(); - } else { + if (id == null) { log(mLogger, CMS.getLogMessage( "CMSCORE_SELFTESTS_PROPERTY_NAME_IS_NULL")); diff --git a/base/java-tools/src/com/netscape/cmstools/AtoB.java b/base/java-tools/src/com/netscape/cmstools/AtoB.java index 51fb3cc17..ee82da2e0 100644 --- a/base/java-tools/src/com/netscape/cmstools/AtoB.java +++ b/base/java-tools/src/com/netscape/cmstools/AtoB.java @@ -60,7 +60,7 @@ public class AtoB { public static void main(String argv[]) { BufferedReader inputBlob = null; - String asciiBASE64BlobChunk = ""; + String asciiBASE64BlobChunk; StringBuffer asciiBASE64Blob = new StringBuffer(); byte binaryBASE64Blob[] = null; diff --git a/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java b/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java index d76e93a52..aaf9fbb17 100644 --- a/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java +++ b/base/java-tools/src/com/netscape/cmstools/CMCRevoke.java @@ -280,7 +280,7 @@ public class CMCRevoke { SignerIdentifier si = null; ContentInfo fullEnrollmentReq = null; String tokenname = "internal"; - String asciiBASE64Blob = ""; + String asciiBASE64Blob = null; try { diff --git a/base/java-tools/src/com/netscape/cmstools/DRMTool.java b/base/java-tools/src/com/netscape/cmstools/DRMTool.java index bb53f1bb3..efd83e892 100644 --- a/base/java-tools/src/com/netscape/cmstools/DRMTool.java +++ b/base/java-tools/src/com/netscape/cmstools/DRMTool.java @@ -1445,7 +1445,7 @@ public class DRMTool { */ private static PublicKey getPublicKey() { BufferedReader inputCert = null; - String encodedBASE64CertChunk = ""; + String encodedBASE64CertChunk; StringBuffer encodedBASE64Cert = new StringBuffer(); byte decodedBASE64Cert[] = null; X509CertImpl cert = null; diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java index a713fb5a3..90d1eff9e 100644 --- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java +++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java @@ -79,7 +79,7 @@ public class PrettyPrintCert { public static void main(String argv[]) { BufferedReader inputCert = null; - String encodedBASE64CertChunk = ""; + String encodedBASE64CertChunk; StringBuffer encodedBASE64Cert = new StringBuffer(); byte decodedBASE64Cert[] = null; diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java index e9056dd48..ebee526d0 100644 --- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java +++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCrl.java @@ -79,7 +79,7 @@ public class PrettyPrintCrl { X509CRLImpl crl = null; Locale aLocale = null; CrlPrettyPrint CrlDetails = null; - String pp = ""; + String pp; FileOutputStream outputCrl = null; // (1) Check that at least one argument was submitted to the program diff --git a/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java b/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java index 85b4ab53e..32fe687a8 100644 --- a/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java +++ b/base/silent/src/com/netscape/pkisilent/ConfigureSubCA.java @@ -23,13 +23,13 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; +import com.netscape.cmsutil.util.Utils; import com.netscape.pkisilent.argparser.ArgParser; import com.netscape.pkisilent.argparser.StringHolder; import com.netscape.pkisilent.common.ComCrypto; import com.netscape.pkisilent.common.ParseXML; import com.netscape.pkisilent.http.HTTPClient; import com.netscape.pkisilent.http.HTTPResponse; -import com.netscape.cmsutil.util.Utils; public class ConfigureSubCA { diff --git a/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java b/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java index ae9bc276e..7558dc88f 100644 --- a/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java +++ b/base/silent/src/com/netscape/pkisilent/common/CMSLDAP.java @@ -557,11 +557,11 @@ public class CMSLDAP { String PASSWORD = args[3]; String BASEDN = args[4]; - String s = + /*String s = "MIICFzCCAYCgAwIBAgIBBjANBgkqhkiG9w0BAQQFADBDMRswGQYDVQQKExJhY2NlcHRhY25ldGVz\ndDEwMjQxFzAVBgNVBAsTDmFjY2VwdGFuY2V0ZXN0MQswCQYDVQQDEwJjYTAeFw0wMzA0MTEyMTUx\nMzZaFw0wNDA0MTAwOTQ2NTVaMFwxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNTU0wxHTAbBgNVBAsT\nFHNzbHRlc3QxMDUwMDk3ODkzNzQ1MSAwHgYDVQQDExdqdXBpdGVyMi5uc2NwLmFvbHR3Lm5ldDBc\nMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDCsCTIIQ+bJMfPHi6kwa7HF+/xSTVHcpZ5zsodXsNWjPlD\noRu/5KAO8NotfwGnYmALWdYnqXCF0q0gkaJQalQTAgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIFoDAR\nBglghkgBhvhCAQEEBAMCBkAwHwYDVR0jBBgwFoAUzxZkSySZT/Y3SxGMEiNyHnLUOPAwDQYJKoZI\nhvcNAQEEBQADgYEALtpqMOtZt6j5KlghDFgdg/dvf36nWiZwC1ap6+ka22shLkA/RjmOix97btzT\nQ+8LcmdkAW5iap4YbtrCu0wdN6IbIEXoQI1QGZBoKO2o02utssXANmTnRCyH/GX2KefQlp1NSRj9\nZNZ+GRT2Qk/8G5Ds9vVjm1I5+/AkzI9jS14="; s = "-----BEGIN CERTIFICATE-----" + "\n" + s + "\n" - + "-----END CERTIFICATE-----\n"; + + "-----END CERTIFICATE-----\n";*/ try { diff --git a/base/silent/src/com/netscape/pkisilent/common/Request.java b/base/silent/src/com/netscape/pkisilent/common/Request.java index e0255ef59..978426c50 100644 --- a/base/silent/src/com/netscape/pkisilent/common/Request.java +++ b/base/silent/src/com/netscape/pkisilent/common/Request.java @@ -664,7 +664,7 @@ public class Request extends TestClient { con.setQueryString(query); con.setActionURL(ACTION_STRING); con.Send(); - StringBuffer s = new StringBuffer(); + StringBuffer s; s = con.getPage(); diff --git a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java index 391df90dc..a966ca1db 100644 --- a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java +++ b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java @@ -131,6 +131,7 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet } } + @Override public String toString() { String presentation = "oid=" + ExtendedKeyUsageExtension.OID + " "; diff --git a/base/util/src/netscape/security/extensions/GenericASN1Extension.java b/base/util/src/netscape/security/extensions/GenericASN1Extension.java index d6bd01223..80617869c 100644 --- a/base/util/src/netscape/security/extensions/GenericASN1Extension.java +++ b/base/util/src/netscape/security/extensions/GenericASN1Extension.java @@ -270,8 +270,9 @@ public class GenericASN1Extension extends Extension /** * Returns a printable representation of the GenericASN1Extension. */ + @Override public String toString() { - return (null); + return super.toString(); } /** diff --git a/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java b/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java index 181360f52..2ccc53ffd 100644 --- a/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java +++ b/base/util/src/netscape/security/extensions/InhibitAnyPolicyExtension.java @@ -101,6 +101,7 @@ public class InhibitAnyPolicyExtension return mSkipCerts; } + @Override public String toString() { String presentation = "ObjectId: " + OID + " "; diff --git a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java index 511255e3a..3d89e1d50 100644 --- a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java +++ b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java @@ -95,6 +95,7 @@ public class OCSPNoCheckExtension extends Extension implements CertAttrSet { } } + @Override public String toString() { String presentation = "oid=" + OID + " "; diff --git a/base/util/src/netscape/security/pkcs/PKCS7.java b/base/util/src/netscape/security/pkcs/PKCS7.java index 4bedc06fe..4ecb2966c 100644 --- a/base/util/src/netscape/security/pkcs/PKCS7.java +++ b/base/util/src/netscape/security/pkcs/PKCS7.java @@ -72,7 +72,7 @@ public class PKCS7 { int len = 0; byte[] newbuf = new byte[len]; byte[] oldbuf = new byte[len]; - byte[] data = new byte[len]; + byte[] data; do { newbuf = new byte[dis.available()]; diff --git a/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java b/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java index 327322b1c..4180473d4 100644 --- a/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java +++ b/base/util/src/netscape/security/x509/CRLDistributionPointsExtension.java @@ -186,6 +186,7 @@ public class CRLDistributionPointsExtension extends Extension } } + @Override public String toString() { return NAME; } diff --git a/base/util/src/netscape/security/x509/FreshestCRLExtension.java b/base/util/src/netscape/security/x509/FreshestCRLExtension.java index b27f01a61..f108b4599 100644 --- a/base/util/src/netscape/security/x509/FreshestCRLExtension.java +++ b/base/util/src/netscape/security/x509/FreshestCRLExtension.java @@ -191,6 +191,7 @@ public class FreshestCRLExtension extends Extension // because it is so complicated. Therefore, we only provide a // minimal implementation. ///////////////////////////////////////////////////////////// + @Override public String toString() { return NAME; } diff --git a/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java b/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java index b1cf61180..67ace692e 100644 --- a/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java +++ b/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java @@ -285,7 +285,7 @@ public class IssuingDistributionPointExtension extends Extension /** * Returns a printable representation of the IssuingDistributionPointExtension */ - + @Override public String toString() { return NAME; } |