RFR: 8283082: sun.security.x509.X509CertImpl.delete("x509.info.validity") nulls out info field
Weijun Wang
weijun at openjdk.org
Tue Jun 28 13:30:41 UTC 2022
On Tue, 28 Jun 2022 13:17:42 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> Could you please review the changes?
>> This is to address the issue: https://bugs.openjdk.org/browse/JDK-8283082?jql=labels%20%3D%20starter-bug
>
> src/java.base/share/classes/sun/security/x509/X509CertImpl.java line 742:
>
>> 740:
>> 741: if (id.equalsIgnoreCase(INFO)) {
>> 742: if (!(attr.getSuffix() != null)) {
>
> You can simply update the `!=` to `==`.
>
> Also, please add a regression test. Since this is about testing an internal method, you are free to add `@modules java.base/sun.security.x509` to access it.
The test can be much simpler than the program included in the bug report. Something like this:
1. Create an empty `X509CertImpl`
2. Add "x509.info"
3. Add "x509.info.issuer"
4. Remove "x509.info.issuer"
5. Add "x509.info.issuer" again
Without the fix, step 4 removes the whole info and step 5 would fail.
-------------
PR: https://git.openjdk.org/jdk/pull/9306
More information about the security-dev
mailing list