Integrated: 8281298: Revise the creation of unmodifiable list

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Mon Feb 7 06:33:11 UTC 2022


On Sat, 5 Feb 2022 20:29:50 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

> In [JDK-8281289](https://bugs.openjdk.java.net/browse/JDK-8281289), the SSLParameters class was updated with the patch:
> 
> - return Collections.<SNIServerName>unmodifiableList(new ArrayList<>(sniNames.values()));
> + return List.copyOf(sniNames.values());
> 
> However, there's a small compatibility risk with this change, `List.copyOf(...).contains(null)` will throw NPE while `Collections.unmodifiableList(...).contains(null)` won't. It may be not worthy of the risk although the impact may be minimal.
> 
> This update will re-use the Collections.unmodifiableList() methods, but re-org the code for better performance.

This pull request has now been integrated.

Changeset: f2302822
Author:    Xue-Lei Andrew Fan <xuelei at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/f2302822c0ef30fbf7cb4e31b8dc1513e9413a23
Stats:     71 lines in 1 file changed: 18 ins; 25 del; 28 mod

8281298: Revise the creation of unmodifiable list

Reviewed-by: redestad

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

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



More information about the security-dev mailing list