summaryrefslogtreecommitdiffstats
path: root/base/util
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-05-23 13:46:25 -0400
committerAde Lee <alee@redhat.com>2012-05-24 23:09:24 -0400
commit2408bec41a56378fcf942a68a1ab290464c001d7 (patch)
treedb5b4ba123c2023c854882188851a42fd35348bf /base/util
parentbe23c86db27b7f66ca16a10ae3ef3f043d1d4b27 (diff)
downloadpki-2408bec41a56378fcf942a68a1ab290464c001d7.tar.gz
pki-2408bec41a56378fcf942a68a1ab290464c001d7.tar.xz
pki-2408bec41a56378fcf942a68a1ab290464c001d7.zip
Patch for fixes for Review Comments
Diffstat (limited to 'base/util')
-rw-r--r--base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java12
-rw-r--r--base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java1
-rw-r--r--base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java2
-rw-r--r--base/util/src/netscape/security/pkcs/PKCS7.java18
-rw-r--r--base/util/src/netscape/security/x509/Attribute.java3
-rw-r--r--base/util/src/netscape/security/x509/GeneralSubtrees.java2
-rw-r--r--base/util/src/netscape/security/x509/IPAddressName.java3
-rw-r--r--base/util/src/netscape/security/x509/PolicyQualifiers.java3
-rwxr-xr-xbase/util/src/netscape/security/x509/RevokedCertImpl.java4
-rwxr-xr-xbase/util/src/netscape/security/x509/X509CRLImpl.java9
-rwxr-xr-xbase/util/src/netscape/security/x509/X509CertImpl.java6
-rw-r--r--base/util/src/netscape/security/x509/X509CertInfo.java15
12 files changed, 29 insertions, 49 deletions
diff --git a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
index 65e5ad9b3..c54f76489 100644
--- a/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
+++ b/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java
@@ -404,14 +404,14 @@ public class CryptoUtil {
*/
public static String reqFormat(String content) {
StringBuffer result = new StringBuffer();
- result.append(CERTREQ_BEGIN_HEADING + System.getProperty("line.separator"));
+ result.append(CERTREQ_BEGIN_HEADING + "\n");
while (content.length() >= LINE_COUNT) {
- result.append(content.substring(0, LINE_COUNT) + System.getProperty("line.separator"));
+ result.append(content.substring(0, LINE_COUNT) + "\n");
content = content.substring(LINE_COUNT);
}
if (content.length() > 0) {
- result.append(content).append(System.getProperty("line.separator") + CERTREQ_END_HEADING);
+ result.append(content + "\n" + CERTREQ_END_HEADING);
} else {
result.append(CERTREQ_END_HEADING);
}
@@ -465,14 +465,14 @@ public class CryptoUtil {
return "";
}
StringBuffer result = new StringBuffer();
- result.append(CERT_BEGIN_HEADING + System.getProperty("line.separator"));
+ result.append(CERT_BEGIN_HEADING + "\n");
while (content.length() >= LINE_COUNT) {
- result.append(content.substring(0, LINE_COUNT) + System.getProperty("line.separator"));
+ result.append(content.substring(0, LINE_COUNT) + "\n");
content = content.substring(LINE_COUNT);
}
if (content.length() > 0) {
- result.append(content + System.getProperty("line.separator") + CERT_END_HEADING);
+ result.append(content + "\n" + CERT_END_HEADING);
} else {
result.append(CERT_END_HEADING);
}
diff --git a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java
index 7c9f8450d..391df90dc 100644
--- a/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java
+++ b/base/util/src/netscape/security/extensions/ExtendedKeyUsageExtension.java
@@ -132,7 +132,6 @@ public class ExtendedKeyUsageExtension extends Extension implements CertAttrSet
}
public String toString() {
-
String presentation = "oid=" + ExtendedKeyUsageExtension.OID + " ";
if (critical) {
diff --git a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java
index 323cfbdbe..511255e3a 100644
--- a/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java
+++ b/base/util/src/netscape/security/extensions/OCSPNoCheckExtension.java
@@ -96,7 +96,7 @@ public class OCSPNoCheckExtension extends Extension implements CertAttrSet {
}
public String toString() {
- String presentation = "oid=" + ExtendedKeyUsageExtension.OID + " ";
+ String presentation = "oid=" + OID + " ";
if (critical) {
presentation += "critical=true";
diff --git a/base/util/src/netscape/security/pkcs/PKCS7.java b/base/util/src/netscape/security/pkcs/PKCS7.java
index b53918233..4bedc06fe 100644
--- a/base/util/src/netscape/security/pkcs/PKCS7.java
+++ b/base/util/src/netscape/security/pkcs/PKCS7.java
@@ -425,22 +425,20 @@ public class PKCS7 {
* Returns the PKCS7 block in a printable string form.
*/
public String toString() {
- StringBuffer out=new StringBuffer();
+ StringBuffer out = new StringBuffer("PKCS7 :: version: " + version + "\n");
-
- out.append("PKCS7 :: version: " + version+System.getProperty("line.separator"));
- out.append("PKCS7 :: digest AlgorithmIds: "+System.getProperty("line.separator"));
+ out.append("PKCS7 :: digest AlgorithmIds: " + "\n");
for (int i = 0; i < digestAlgorithmIds.length; i++) {
- out.append("\t" + digestAlgorithmIds[i]+System.getProperty("line.separator"));
+ out.append("\t" + digestAlgorithmIds[i] + "\n");
}
- out.append(contentInfo).append(System.getProperty("line.separator"));
- out.append("PKCS7 :: certificates: "+System.getProperty("line.separator"));
+ out.append(contentInfo + "\n");
+ out.append("PKCS7 :: certificates: " + "\n");
for (int i = 0; i < certificates.length; i++) {
- out.append("\t" + i + ". " + certificates[i]+System.getProperty("line.separator"));
+ out.append("\t" + i + ". " + certificates[i] + "\n");
}
- out.append("PKCS7 :: signer infos: "+System.getProperty("line.separator"));
+ out.append("PKCS7 :: signer infos: " + "\n");
for (int i = 0; i < signerInfos.length; i++) {
- out.append("\t" + i + ". " + signerInfos[i]+System.getProperty("line.separator"));
+ out.append("\t" + i + ". " + signerInfos[i] + "\n");
}
return out.toString();
}
diff --git a/base/util/src/netscape/security/x509/Attribute.java b/base/util/src/netscape/security/x509/Attribute.java
index 8c3fc1fbd..760d0a805 100644
--- a/base/util/src/netscape/security/x509/Attribute.java
+++ b/base/util/src/netscape/security/x509/Attribute.java
@@ -214,8 +214,7 @@ public final class Attribute implements Serializable, DerEncoder {
*/
public String toString() {
String theoid = "Attribute: " + oid + "\n";
- StringBuffer values = new StringBuffer();
- values.append("Values: ");
+ StringBuffer values = new StringBuffer("Values: ");
Enumeration<String> n = valueSet.elements();
if (n.hasMoreElements()) {
values.append(n.nextElement());
diff --git a/base/util/src/netscape/security/x509/GeneralSubtrees.java b/base/util/src/netscape/security/x509/GeneralSubtrees.java
index d24774ab4..66ccdba84 100644
--- a/base/util/src/netscape/security/x509/GeneralSubtrees.java
+++ b/base/util/src/netscape/security/x509/GeneralSubtrees.java
@@ -80,7 +80,7 @@ public class GeneralSubtrees {
for (Enumeration<GeneralSubtree> e = trees.elements(); e.hasMoreElements();) {
element = e.nextElement();
- s.append(pp.indent(indent + 4) + element.toPrint(indent) + System.getProperty("line.separator"));
+ s.append(pp.indent(indent + 4) + element.toPrint(indent) + "\n");
}
return (s.toString());
diff --git a/base/util/src/netscape/security/x509/IPAddressName.java b/base/util/src/netscape/security/x509/IPAddressName.java
index 4ff8b8a0c..bb27548a3 100644
--- a/base/util/src/netscape/security/x509/IPAddressName.java
+++ b/base/util/src/netscape/security/x509/IPAddressName.java
@@ -142,8 +142,7 @@ public class IPAddressName implements GeneralNameInterface {
+ (address[1] & 0xff) + "."
+ (address[2] & 0xff) + "." + (address[3] & 0xff));
} else {
- StringBuffer r = new StringBuffer();
- r.append("IPAddress: " + Integer.toHexString(address[0] & 0xff));
+ StringBuffer r = new StringBuffer("IPAddress: " + Integer.toHexString(address[0] & 0xff));
String hexString = Integer.toHexString(address[1] & 0xff);
if (hexString.length() == 1) {
r.append("0" + hexString);
diff --git a/base/util/src/netscape/security/x509/PolicyQualifiers.java b/base/util/src/netscape/security/x509/PolicyQualifiers.java
index def90066e..de946a6d5 100644
--- a/base/util/src/netscape/security/x509/PolicyQualifiers.java
+++ b/base/util/src/netscape/security/x509/PolicyQualifiers.java
@@ -78,8 +78,7 @@ public class PolicyQualifiers implements java.io.Serializable {
* Returns a printable representation of the CertificatePolicyId.
*/
public String toString() {
- StringBuffer s = new StringBuffer();
- s.append("PolicyQualifiers: [");
+ StringBuffer s = new StringBuffer("PolicyQualifiers: [");
for (int i = 0; i < mInfo.size(); i++) {
PolicyQualifierInfo pq = mInfo.elementAt(i);
s.append(pq.toString());
diff --git a/base/util/src/netscape/security/x509/RevokedCertImpl.java b/base/util/src/netscape/security/x509/RevokedCertImpl.java
index 866f1c0d9..df3bc37a8 100755
--- a/base/util/src/netscape/security/x509/RevokedCertImpl.java
+++ b/base/util/src/netscape/security/x509/RevokedCertImpl.java
@@ -281,10 +281,8 @@ public class RevokedCertImpl extends RevokedCertificate implements Serializable
* @return value of this revoked certificate in a printable form.
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = new StringBuffer(serialNumber.toString() + " On: " + revocationDate.toString());
- sb.append(serialNumber.toString());
- sb.append(" On: " + revocationDate.toString());
if (extensions != null) {
sb.append("\n");
for (int i = 0; i < extensions.size(); i++)
diff --git a/base/util/src/netscape/security/x509/X509CRLImpl.java b/base/util/src/netscape/security/x509/X509CRLImpl.java
index 9725db640..6c84084c5 100755
--- a/base/util/src/netscape/security/x509/X509CRLImpl.java
+++ b/base/util/src/netscape/security/x509/X509CRLImpl.java
@@ -514,12 +514,9 @@ public class X509CRLImpl extends X509CRL {
* @return value of this CRL in a printable form.
*/
public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("X.509 CRL v" + (version + 1) + "\n");
- sb.append("Signature Algorithm: " + sigAlgId +
- ", OID=" + sigAlgId.getOID() + "\n");
- sb.append("Issuer: " + issuer + "\n");
- sb.append("\nThis Update: " + thisUpdate + "\n");
+ StringBuffer sb = new StringBuffer("X.509 CRL v" + (version + 1) + "\n" + "Signature Algorithm: " + sigAlgId +
+ ", OID=" + sigAlgId.getOID() + "\n" + "Issuer: " + issuer + "\n" + "\nThis Update: " + thisUpdate
+ + "\n");
if (nextUpdate != null)
sb.append("Next Update: " + nextUpdate + "\n");
if (revokedCerts.isEmpty())
diff --git a/base/util/src/netscape/security/x509/X509CertImpl.java b/base/util/src/netscape/security/x509/X509CertImpl.java
index 26b88fe3d..05de623ce 100755
--- a/base/util/src/netscape/security/x509/X509CertImpl.java
+++ b/base/util/src/netscape/security/x509/X509CertImpl.java
@@ -643,11 +643,7 @@ public class X509CertImpl extends X509Certificate
if (info == null || algId == null || signature == null)
return "";
- StringBuffer sb = new StringBuffer();
-
- sb.append("[\n");
- sb.append(info.toString() + "\n");
- sb.append(" Algorithm: [" + algId.toString() + "]\n");
+ StringBuffer sb = new StringBuffer("[\n"+info.toString() + "\n" + " Algorithm: [" + algId.toString() + "]\n");
netscape.security.util.PrettyPrintFormat pp =
new netscape.security.util.PrettyPrintFormat(" ", 20);
diff --git a/base/util/src/netscape/security/x509/X509CertInfo.java b/base/util/src/netscape/security/x509/X509CertInfo.java
index 314c3ad2b..0c44e2c92 100644
--- a/base/util/src/netscape/security/x509/X509CertInfo.java
+++ b/base/util/src/netscape/security/x509/X509CertInfo.java
@@ -333,17 +333,12 @@ public class X509CertInfo implements CertAttrSet, Serializable {
|| issuer == null || algId == null || serialNum == null) {
throw new NullPointerException("X.509 cert is incomplete");
}
- StringBuffer sb = new StringBuffer();
-
- sb.append("[\n");
- sb.append(" " + version.toString() + "\n");
- sb.append(" Subject: " + subject.toString() + "\n");
- sb.append(" Signature Algorithm: " + algId.toString() + "\n");
- sb.append(" Key: " + pubKey.toString() + "\n");
- sb.append(" " + interval.toString() + "\n");
- sb.append(" Issuer: " + issuer.toString() + "\n");
- sb.append(" " + serialNum.toString() + "\n");
+ StringBuffer sb = new StringBuffer("[\n" + " " + version.toString() + "\n" + " Subject: "
+ + subject.toString() + "\n"
+ + " Signature Algorithm: " + algId.toString() + "\n" + " Key: " + pubKey.toString() + "\n");
+ sb.append(" " + interval.toString() + "\n" + " Issuer: " + issuer.toString() + "\n"
+ + " " + serialNum.toString() + "\n");
// optional v2, v3 extras
if (issuerUniqueId != null) {
sb.append(" Issuer Id:\n" + issuerUniqueId.toString() + "\n");