mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8274679: Remove unnecessary conversion to String in security code in java.base
Reviewed-by: weijun
This commit is contained in:
parent
76477f8cdb
commit
debaa28e9c
14 changed files with 48 additions and 55 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -110,8 +110,8 @@ public class PKIXCertPathBuilderResult extends PKIXCertPathValidatorResult
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("PKIXCertPathBuilderResult: [\n");
|
||||
sb.append(" Certification Path: " + certPath + "\n");
|
||||
sb.append(" Trust Anchor: " + getTrustAnchor().toString() + "\n");
|
||||
sb.append(" Policy Tree: " + String.valueOf(getPolicyTree()) + "\n");
|
||||
sb.append(" Trust Anchor: " + getTrustAnchor() + "\n");
|
||||
sb.append(" Policy Tree: " + getPolicyTree() + "\n");
|
||||
sb.append(" Subject Public Key: " + getPublicKey() + "\n");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -150,8 +150,8 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult {
|
|||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("PKIXCertPathValidatorResult: [\n");
|
||||
sb.append(" Trust Anchor: " + trustAnchor.toString() + "\n");
|
||||
sb.append(" Policy Tree: " + String.valueOf(policyTree) + "\n");
|
||||
sb.append(" Trust Anchor: " + trustAnchor + "\n");
|
||||
sb.append(" Policy Tree: " + policyTree + "\n");
|
||||
sb.append(" Subject Public Key: " + subjectPublicKey + "\n");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
|
|
@ -696,8 +696,7 @@ public class PKIXParameters implements CertPathParameters {
|
|||
|
||||
/* start with trusted anchor info */
|
||||
if (unmodTrustAnchors != null) {
|
||||
sb.append(" Trust Anchors: " + unmodTrustAnchors.toString()
|
||||
+ "\n");
|
||||
sb.append(" Trust Anchors: " + unmodTrustAnchors + "\n");
|
||||
}
|
||||
|
||||
/* now, append initial state information */
|
||||
|
@ -706,13 +705,13 @@ public class PKIXParameters implements CertPathParameters {
|
|||
sb.append(" Initial Policy OIDs: any\n");
|
||||
} else {
|
||||
sb.append(" Initial Policy OIDs: ["
|
||||
+ unmodInitialPolicies.toString() + "]\n");
|
||||
+ unmodInitialPolicies + "]\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(" Validity Date: " + date + "\n");
|
||||
sb.append(" Signature Provider: " + sigProvider + "\n");
|
||||
sb.append(" Default Revocation Enabled: " + revocationEnabled + "\n");
|
||||
sb.append(" Explicit Policy Required: " + explicitPolicyRequired + "\n");
|
||||
sb.append(" Policy Mapping Inhibited: " + policyMappingInhibited + "\n");
|
||||
|
@ -720,14 +719,14 @@ public class PKIXParameters implements CertPathParameters {
|
|||
sb.append(" Policy Qualifiers Rejected: " + policyQualifiersRejected + "\n");
|
||||
|
||||
/* now, append target cert requirements */
|
||||
sb.append(" Target Cert Constraints: " + String.valueOf(certSelector) + "\n");
|
||||
sb.append(" Target Cert Constraints: " + certSelector + "\n");
|
||||
|
||||
/* finally, append miscellaneous parameters */
|
||||
if (certPathCheckers != null)
|
||||
sb.append(" Certification Path Checkers: ["
|
||||
+ certPathCheckers.toString() + "]\n");
|
||||
+ certPathCheckers + "]\n");
|
||||
if (certStores != null)
|
||||
sb.append(" CertStores: [" + certStores.toString() + "]\n");
|
||||
sb.append(" CertStores: [" + certStores + "]\n");
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -323,14 +323,13 @@ public class TrustAnchor {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("[\n");
|
||||
if (pubKey != null) {
|
||||
sb.append(" Trusted CA Public Key: " + pubKey.toString() + "\n");
|
||||
sb.append(" Trusted CA Issuer Name: "
|
||||
+ String.valueOf(caName) + "\n");
|
||||
sb.append(" Trusted CA Public Key: " + pubKey + "\n");
|
||||
sb.append(" Trusted CA Issuer Name: " + caName + "\n");
|
||||
} else {
|
||||
sb.append(" Trusted CA cert: " + trustedCert.toString() + "\n");
|
||||
sb.append(" Trusted CA cert: " + trustedCert + "\n");
|
||||
}
|
||||
if (nc != null)
|
||||
sb.append(" Name Constraints: " + nc.toString() + "\n");
|
||||
sb.append(" Name Constraints: " + nc + "\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -1763,10 +1763,10 @@ public class X509CertSelector implements CertSelector {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("X509CertSelector: [\n");
|
||||
if (x509Cert != null) {
|
||||
sb.append(" Certificate: " + x509Cert.toString() + "\n");
|
||||
sb.append(" Certificate: " + x509Cert + "\n");
|
||||
}
|
||||
if (serialNumber != null) {
|
||||
sb.append(" Serial Number: " + serialNumber.toString() + "\n");
|
||||
sb.append(" Serial Number: " + serialNumber + "\n");
|
||||
}
|
||||
if (issuer != null) {
|
||||
sb.append(" Issuer: " + getIssuerAsString() + "\n");
|
||||
|
@ -1775,7 +1775,7 @@ public class X509CertSelector implements CertSelector {
|
|||
sb.append(" Subject: " + getSubjectAsString() + "\n");
|
||||
}
|
||||
sb.append(" matchAllSubjectAltNames flag: "
|
||||
+ String.valueOf(matchAllSubjectAltNames) + "\n");
|
||||
+ matchAllSubjectAltNames + "\n");
|
||||
if (subjectAlternativeNames != null) {
|
||||
sb.append(" SubjectAlternativeNames:\n");
|
||||
for (List<?> list : subjectAlternativeNames) {
|
||||
|
@ -1795,29 +1795,29 @@ public class X509CertSelector implements CertSelector {
|
|||
}
|
||||
if (certificateValid != null) {
|
||||
sb.append(" Certificate Valid: " +
|
||||
certificateValid.toString() + "\n");
|
||||
certificateValid + "\n");
|
||||
}
|
||||
if (privateKeyValid != null) {
|
||||
sb.append(" Private Key Valid: " +
|
||||
privateKeyValid.toString() + "\n");
|
||||
privateKeyValid + "\n");
|
||||
}
|
||||
if (subjectPublicKeyAlgID != null) {
|
||||
sb.append(" Subject Public Key AlgID: " +
|
||||
subjectPublicKeyAlgID.toString() + "\n");
|
||||
subjectPublicKeyAlgID + "\n");
|
||||
}
|
||||
if (subjectPublicKey != null) {
|
||||
sb.append(" Subject Public Key: " +
|
||||
subjectPublicKey.toString() + "\n");
|
||||
subjectPublicKey + "\n");
|
||||
}
|
||||
if (keyUsage != null) {
|
||||
sb.append(" Key Usage: " + keyUsageToString(keyUsage) + "\n");
|
||||
}
|
||||
if (keyPurposeSet != null) {
|
||||
sb.append(" Extended Key Usage: " +
|
||||
keyPurposeSet.toString() + "\n");
|
||||
keyPurposeSet + "\n");
|
||||
}
|
||||
if (policy != null) {
|
||||
sb.append(" Policy: " + policy.toString() + "\n");
|
||||
sb.append(" Policy: " + policy + "\n");
|
||||
}
|
||||
if (pathToGeneralNames != null) {
|
||||
sb.append(" Path to names:\n");
|
||||
|
@ -2145,7 +2145,7 @@ public class X509CertSelector implements CertSelector {
|
|||
debug.println("X509CertSelector.match: private key usage not "
|
||||
+ "within validity date; ext.NOT_BEFORE: "
|
||||
+ time + "; X509CertSelector: "
|
||||
+ this.toString());
|
||||
+ this);
|
||||
e2.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
|
@ -2153,7 +2153,7 @@ public class X509CertSelector implements CertSelector {
|
|||
if (debug != null) {
|
||||
debug.println("X509CertSelector.match: IOException in "
|
||||
+ "private key usage check; X509CertSelector: "
|
||||
+ this.toString());
|
||||
+ this);
|
||||
e4.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue