RFR: 8296142: CertAttrSet::(getName|getElements|delete) are mostly useless
Andrey Turbanov
aturbanov at openjdk.org
Sun Nov 27 13:43:22 UTC 2022
On Tue, 1 Nov 2022 13:34:40 GMT, Weijun Wang <weijun at openjdk.org> wrote:
> This code change removes `getElements()` and `delete()` from `CertAttrSet` and all its subclasses. The `getName()` method is moved to `s.s.x.Extension` since it's only useful there.
>
> Except for removing lines, the only place where real changes are made are:
>
> 1. `getName()` in `Extension`.
> 2. No need to cast to into a `CertAttrSet` object in `CertificateExtensions::parseExtension` at https://github.com/openjdk/jdk/pull/10934/files#diff-0b9f279d1a1537d66ce5adf4e2abcff9a15d4905f500539a6cf52e9f6710aef7R108-R109, since `getName()` is in `Extension` now.
> 3. No need to call different methods `CertAttrSet::getName` and `Extension::getExtensionId::toString` depending on the types in `CertificateExtensions::equals` at https://github.com/openjdk/jdk/pull/10934/files#diff-0b9f279d1a1537d66ce5adf4e2abcff9a15d4905f500539a6cf52e9f6710aef7L298-L303, since the default implementation in `Extension::getName` is already returning the OID.
>
> The last 2 points are also true for `CRLExtensions`.
src/java.base/share/classes/sun/security/x509/NetscapeCertTypeExtension.java line 281:
> 279: */
> 280: public Enumeration<String> getElements() {
> 281: return mAttributeNames.elements();
Looks like we can drop `mAttributeNames` now. It was used only here.
-------------
PR: https://git.openjdk.org/jdk/pull/10934
More information about the security-dev
mailing list