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

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


 681             // other class fields are immutable to public, don't bother
 682             // to clone the read-only fields.
 683             return copy;
 684         } catch (CloneNotSupportedException e) {
 685             /* Cannot happen */
 686             throw new InternalError(e.toString(), e);
 687         }
 688     }
 689 
 690     /**
 691      * Returns a formatted string describing the parameters.
 692      *
 693      * @return a formatted string describing the parameters.
 694      */
 695     public String toString() {
 696         StringBuilder sb = new StringBuilder();
 697         sb.append("[\n");
 698 
 699         /* start with trusted anchor info */
 700         if (unmodTrustAnchors != null) {
 701             sb.append("  Trust Anchors: " + unmodTrustAnchors.toString()
 702                 + "\n");
 703         }
 704 
 705         /* now, append initial state information */
 706         if (unmodInitialPolicies != null) {
 707             if (unmodInitialPolicies.isEmpty()) {
 708                 sb.append("  Initial Policy OIDs: any\n");
 709             } else {
 710                 sb.append("  Initial Policy OIDs: ["
 711                     + unmodInitialPolicies.toString() + "]\n");
 712             }
 713         }
 714 
 715         /* now, append constraints on all certificates in the path */
 716         sb.append("  Validity Date: " + String.valueOf(date) + "\n");
 717         sb.append("  Signature Provider: " + String.valueOf(sigProvider) + "\n");
 718         sb.append("  Default Revocation Enabled: " + revocationEnabled + "\n");
 719         sb.append("  Explicit Policy Required: " + explicitPolicyRequired + "\n");
 720         sb.append("  Policy Mapping Inhibited: " + policyMappingInhibited + "\n");
 721         sb.append("  Any Policy Inhibited: " + anyPolicyInhibited + "\n");
 722         sb.append("  Policy Qualifiers Rejected: " + policyQualifiersRejected + "\n");







 723 
 724         /* now, append target cert requirements */
 725         sb.append("  Target Cert Constraints: " + String.valueOf(certSelector) + "\n");

 726 
 727         /* finally, append miscellaneous parameters */
 728         if (certPathCheckers != null)
 729             sb.append("  Certification Path Checkers: ["
 730                 + certPathCheckers.toString() + "]\n");
 731         if (certStores != null)
 732             sb.append("  CertStores: [" + certStores.toString() + "]\n");
 733         sb.append("]");



 734         return sb.toString();
 735     }
 736 }


 681             // other class fields are immutable to public, don't bother
 682             // to clone the read-only fields.
 683             return copy;
 684         } catch (CloneNotSupportedException e) {
 685             /* Cannot happen */
 686             throw new InternalError(e.toString(), e);
 687         }
 688     }
 689 
 690     /**
 691      * Returns a formatted string describing the parameters.
 692      *
 693      * @return a formatted string describing the parameters.
 694      */
 695     public String toString() {
 696         StringBuilder sb = new StringBuilder();
 697         sb.append("[\n");
 698 
 699         /* start with trusted anchor info */
 700         if (unmodTrustAnchors != null) {
 701             sb.append("  Trust Anchors: ").append(unmodTrustAnchors)
 702                     .append('\n');
 703         }
 704 
 705         /* now, append initial state information */
 706         if (unmodInitialPolicies != null) {
 707             if (unmodInitialPolicies.isEmpty()) {
 708                 sb.append("  Initial Policy OIDs: any\n");
 709             } else {
 710                 sb.append("  Initial Policy OIDs: [")
 711                         .append(unmodInitialPolicies).append("]\n");
 712             }
 713         }
 714 
 715         /* now, append constraints on all certificates in the path */
 716         sb.append("  Validity Date: ").append(date)
 717                 .append('\n');
 718         sb.append("  Signature Provider: ").append(sigProvider)
 719                 .append('\n');
 720         sb.append("  Default Revocation Enabled: ").append(revocationEnabled)
 721                 .append('\n');
 722         sb.append("  Explicit Policy Required: ")
 723                 .append(explicitPolicyRequired).append('\n');
 724         sb.append("  Policy Mapping Inhibited: ")
 725                 .append(policyMappingInhibited).append('\n');
 726         sb.append("  Any Policy Inhibited: ").append(anyPolicyInhibited)
 727                 .append('\n');
 728         sb.append("  Policy Qualifiers Rejected: ")
 729                 .append(policyQualifiersRejected).append('\n');
 730 
 731         /* now, append target cert requirements */
 732         sb.append("  Target Cert Constraints: ")
 733                 .append(certSelector).append('\n');
 734 
 735         /* finally, append miscellaneous parameters */
 736         if (certPathCheckers != null) {
 737             sb.append("  Certification Path Checkers: [")
 738                     .append(certPathCheckers).append("]\n");
 739         }
 740         if (certStores != null) {
 741             sb.append("  CertStores: [").append(certStores)
 742                     .append("]\n");
 743         }
 744         sb.append(']');
 745         return sb.toString();
 746     }
 747 }