summaryrefslogtreecommitdiffstats
path: root/base/ca
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-06-11 16:21:26 -0400
committerEndi Sukma Dewata <edewata@redhat.com>2012-06-15 17:12:15 -0500
commit10326ad4fe1b3db620f43feb3f47c4fd008f3f33 (patch)
tree4d4a0f719bbbea6d6db53ef3fab5f3717411cfb9 /base/ca
parentc53ca291e21761f1de5417ef596afba395a7f5d1 (diff)
downloadpki-10326ad4fe1b3db620f43feb3f47c4fd008f3f33.tar.gz
pki-10326ad4fe1b3db620f43feb3f47c4fd008f3f33.tar.xz
pki-10326ad4fe1b3db620f43feb3f47c4fd008f3f33.zip
Fixes for Coverity issues of type Stringbuffer, NO_EQUALS_METHOD , REVERSE_INULL,Wrong_Map_Iterators
Diffstat (limited to 'base/ca')
-rw-r--r--base/ca/src/com/netscape/ca/CMSCRLExtensions.java12
-rw-r--r--base/ca/src/com/netscape/ca/CRLIssuingPoint.java35
2 files changed, 23 insertions, 24 deletions
diff --git a/base/ca/src/com/netscape/ca/CMSCRLExtensions.java b/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
index 507faa8e8..11f810af2 100644
--- a/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
+++ b/base/ca/src/com/netscape/ca/CMSCRLExtensions.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.security.cert.CertificateException;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
@@ -581,8 +582,9 @@ public class CMSCRLExtensions implements ICMSCRLExtensions {
ip = ca.getCRLIssuingPoint(ipId);
}
- for (String name : nvp.keySet()) {
- String value = nvp.get(name);
+ for (Map.Entry<String,String> entry : nvp.entrySet()) {
+ String name = entry.getKey();
+ String value = entry.getValue();
if (name.equals(PROP_ENABLE)) {
if (!(value.equals(Constants.TRUE) || value.equals(Constants.FALSE))) {
@@ -618,8 +620,10 @@ public class CMSCRLExtensions implements ICMSCRLExtensions {
boolean crlCACertsOnly = false;
boolean issuingDistPointExtEnabled = false;
-
- CMSCRLExtensions cmsCRLExtensions = (CMSCRLExtensions) ip.getCRLExtensions();
+ CMSCRLExtensions cmsCRLExtensions = null;
+ if (ip != null) {
+ cmsCRLExtensions = (CMSCRLExtensions) ip.getCRLExtensions();
+ }
if (cmsCRLExtensions != null) {
issuingDistPointExtEnabled =
cmsCRLExtensions.isCRLExtensionEnabled(IssuingDistributionPointExtension.NAME);
diff --git a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
index 5dd823737..46891fd6b 100644
--- a/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
+++ b/base/ca/src/com/netscape/ca/CRLIssuingPoint.java
@@ -25,6 +25,7 @@ import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.LinkedHashSet;
+import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TimeZone;
@@ -930,8 +931,9 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
boolean noRestart = true;
boolean modifiedSchedule = false;
- for (String name : params.keySet()) {
- String value = params.get(name);
+ for (Map.Entry<String, String> entry : params.entrySet()) {
+ String name = entry.getKey();
+ String value = entry.getValue();
// -- Update Schema --
if (name.equals(Constants.PR_ENABLE_CRL)) {
@@ -2707,7 +2709,7 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
long totalTime = 0;
long crlTime = 0;
long deltaTime = 0;
- String splitTimes = " (";
+ StringBuilder splitTimes = new StringBuilder(" (");
for (int i = 0; i < mSplits.length; i++) {
totalTime += mSplits[i];
if (i > 0 && i < 5) {
@@ -2716,13 +2718,10 @@ public class CRLIssuingPoint implements ICRLIssuingPoint, Runnable {
crlTime += mSplits[i];
}
if (i > 0)
- splitTimes += ",";
- splitTimes += Long.toString(mSplits[i]);
+ splitTimes.append(",");
+ splitTimes.append(mSplits[i]);
}
- splitTimes +=
- ","
- + Long.toString(deltaTime) + "," + Long.toString(crlTime) + ","
- + Long.toString(totalTime) + ")";
+ splitTimes.append(String.format(",%d,%d,%d)",deltaTime,crlTime,totalTime));
mLogger.log(ILogger.EV_AUDIT, ILogger.S_OTHER,
AuditFormat.LEVEL,
CMS.getLogMessage("CMSCORE_CA_CA_CRL_UPDATED"),
@@ -3095,14 +3094,12 @@ class CertRecProcessor implements IElementProcessor {
return includeCert;
}
boolean reasonMatch = false;
- if (reason != null) {
- if (mOnlySomeReasons != null) {
- reasonMatch = mOnlySomeReasons.get(reasonIndex);
- if (reasonMatch != true) {
- includeCert = false;
- } else {
- CMS.debug("onlySomeReasons match! reason: " + reason);
- }
+ if (mOnlySomeReasons != null) {
+ reasonMatch = mOnlySomeReasons.get(reasonIndex);
+ if (reasonMatch != true) {
+ includeCert = false;
+ } else {
+ CMS.debug("onlySomeReasons match! reason: " + reason);
}
}
@@ -3150,9 +3147,7 @@ class CertRecProcessor implements IElementProcessor {
if (includeCert == true) {
mCRLCerts.put(serialNumber, newRevokedCert);
- if (serialNumber != null) {
- CMS.debug("Putting certificate serial: 0x" + serialNumber.toString(16) + " into CRL hashtable");
- }
+ CMS.debug("Putting certificate serial: 0x" + serialNumber.toString(16) + " into CRL hashtable");
}
} catch (EBaseException e) {
CMS.debug(