summaryrefslogtreecommitdiffstats
path: root/base/java-tools
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/java-tools
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/java-tools')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/CMCResponse.java4
-rw-r--r--base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java9
2 files changed, 6 insertions, 7 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
index eae0b7303..50db485a4 100644
--- a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
+++ b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
@@ -122,10 +122,10 @@ public class CMCResponse {
ASN1Util.encode(sts.elementAt(j)));
SEQUENCE seq = cst.getBodyList();
- String s = " BodyList: ";
+ StringBuilder s = new StringBuilder(" BodyList: ");
for (int k = 0; k < seq.size(); k++) {
INTEGER n = (INTEGER) seq.elementAt(k);
- s = s + n.toString() + " ";
+ s.append(n.toString() + " ");
}
System.out.println(s);
int st = cst.getStatus();
diff --git a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
index 90d1eff9e..100304cfe 100644
--- a/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
+++ b/base/java-tools/src/com/netscape/cmstools/PrettyPrintCert.java
@@ -86,7 +86,7 @@ public class PrettyPrintCert {
X509CertImpl cert = null;
Locale aLocale = null;
CertPrettyPrint certDetails = null;
- String pp = "";
+ StringBuilder pp = new StringBuilder();
FileOutputStream outputCert = null;
boolean mSimpleInfo = false;
String inputfile = null;
@@ -194,11 +194,10 @@ public class PrettyPrintCert {
X500Name dname = (X500Name) csn.get(CertificateSubjectName.DN_NAME);
- pp = "";
RDN[] rdns = dname.getNames();
for (int i = rdns.length - 1; i >= 0; i--) {
- pp = pp + rdns[i] + "\n";
+ pp.append(rdns[i] + "\n");
}
} catch (Exception e) {
@@ -213,7 +212,7 @@ public class PrettyPrintCert {
certDetails = new CertPrettyPrint(cert);
// (9) Convert the CertPrettyPrint() object into a String() object
- pp = certDetails.toString(aLocale);
+ pp.append(certDetails.toString(aLocale));
}
// (10) Finally, "pretty print" the actual certificate to the console
@@ -230,7 +229,7 @@ public class PrettyPrintCert {
}
try {
- outputCert.write(pp.getBytes());
+ outputCert.write(pp.toString().getBytes());
} catch (IOException e) {
System.out.println("PrettyPrintCert: Unexpected error " +
"encountered while attempting to write() " +