RFR: JDK-8291509 Minor cleanup could be done in sun.security [v3]
Mark Powers
mpowers at openjdk.org
Wed Aug 31 22:28:38 UTC 2022
On Tue, 30 Aug 2022 20:23:26 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> Mark Powers has updated the pull request incrementally with one additional commit since the last revision:
>>
>> white space
>
> src/java.base/share/classes/sun/security/pkcs10/PKCS10Attributes.java line 184:
>
>> 182: return false;
>> 183: PKCS10Attribute thisAttr, otherAttr;
>> 184: String key;
>
> This whole `toString` method can be enhanced. Can we just compare `this.map.equals(that.map)`?
Don't know what you mean about changing `toString`. I could change `equals` to something like:
public boolean equals(Object other) {
if (!(other instanceof PKCS10Attributes))
return false;
Collection<PKCS10Attribute> othersAttribs =
((PKCS10Attributes)other).getAttributes();
PKCS10Attribute[] attrs =
othersAttribs.toArray(new PKCS10Attribute[0]);
PKCS10Attributes foo = new PKCS10Attributes(attrs);
return this.map.equals(foo.map);
}
-------------
PR: https://git.openjdk.org/jdk/pull/9972
More information about the security-dev
mailing list