On Tue, 19 Jan 2021 17:54:33 GMT, Sean Coffey <coff...@openjdk.org> wrote:

> Correction of NPE and updating of test cases. Minor refactoring of test 
> library also.

src/java.base/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
 line 248:

> 246:             int anchorCertId = 0;
> 247:             X509Certificate trustedCert = anchor.getTrustedCert();
> 248:             if (trustedCert != null) {

You could use the `anchorCert` variable which was set earlier instead of 
calling `getTrustedCert()` again.

src/java.base/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
 line 251:

> 249:                 anchorCertId = trustedCert.hashCode();
> 250:             } else {
> 251:                 if (anchor.getCAPublicKey() != null) {

Per the TrustAnchor API, you can't create a TrustAnchor with a null public key, 
so I don't think you need this check.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2150

Reply via email to