RFR: 8255348: NPE in PKIXCertPathValidator event logging code

Seán Coffey sean.coffey at oracle.com
Fri Jan 22 13:13:55 UTC 2021


Thanks for the comments Sean. Code updated.

https://github.com/openjdk/jdk/pull/2150/commits/8a344a85303297f17a6e75e7c1f423c2d16c451a

regards,
Sean.

On 21/01/2021 19:47, Sean Mullan wrote:
> On Tue, 19 Jan 2021 17:54:33 GMT, Sean Coffey <coffeys at 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


More information about the hotspot-jfr-dev mailing list