src/java.base/share/classes/java/security/cert/PKIXParameters.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>

@@ -696,41 +696,52 @@
         StringBuilder sb = new StringBuilder();
         sb.append("[\n");
 
         /* start with trusted anchor info */
         if (unmodTrustAnchors != null) {
-            sb.append("  Trust Anchors: " + unmodTrustAnchors.toString()
-                + "\n");
+            sb.append("  Trust Anchors: ").append(unmodTrustAnchors)
+                    .append('\n');
         }
 
         /* now, append initial state information */
         if (unmodInitialPolicies != null) {
             if (unmodInitialPolicies.isEmpty()) {
                 sb.append("  Initial Policy OIDs: any\n");
             } else {
-                sb.append("  Initial Policy OIDs: ["
-                    + unmodInitialPolicies.toString() + "]\n");
+                sb.append("  Initial Policy OIDs: [")
+                        .append(unmodInitialPolicies).append("]\n");
             }
         }
 
         /* now, append constraints on all certificates in the path */
-        sb.append("  Validity Date: " + String.valueOf(date) + "\n");
-        sb.append("  Signature Provider: " + String.valueOf(sigProvider) + "\n");
-        sb.append("  Default Revocation Enabled: " + revocationEnabled + "\n");
-        sb.append("  Explicit Policy Required: " + explicitPolicyRequired + "\n");
-        sb.append("  Policy Mapping Inhibited: " + policyMappingInhibited + "\n");
-        sb.append("  Any Policy Inhibited: " + anyPolicyInhibited + "\n");
-        sb.append("  Policy Qualifiers Rejected: " + policyQualifiersRejected + "\n");
+        sb.append("  Validity Date: ").append(date)
+                .append('\n');
+        sb.append("  Signature Provider: ").append(sigProvider)
+                .append('\n');
+        sb.append("  Default Revocation Enabled: ").append(revocationEnabled)
+                .append('\n');
+        sb.append("  Explicit Policy Required: ")
+                .append(explicitPolicyRequired).append('\n');
+        sb.append("  Policy Mapping Inhibited: ")
+                .append(policyMappingInhibited).append('\n');
+        sb.append("  Any Policy Inhibited: ").append(anyPolicyInhibited)
+                .append('\n');
+        sb.append("  Policy Qualifiers Rejected: ")
+                .append(policyQualifiersRejected).append('\n');
 
         /* now, append target cert requirements */
-        sb.append("  Target Cert Constraints: " + String.valueOf(certSelector) + "\n");
+        sb.append("  Target Cert Constraints: ")
+                .append(certSelector).append('\n');
 
         /* finally, append miscellaneous parameters */
-        if (certPathCheckers != null)
-            sb.append("  Certification Path Checkers: ["
-                + certPathCheckers.toString() + "]\n");
-        if (certStores != null)
-            sb.append("  CertStores: [" + certStores.toString() + "]\n");
-        sb.append("]");
+        if (certPathCheckers != null) {
+            sb.append("  Certification Path Checkers: [")
+                    .append(certPathCheckers).append("]\n");
+        }
+        if (certStores != null) {
+            sb.append("  CertStores: [").append(certStores)
+                    .append("]\n");
+        }
+        sb.append(']');
         return sb.toString();
     }
 }