RFR: JDK-8291509 Minor cleanup could be done in sun.security [v8]

Weijun Wang weijun at openjdk.org
Wed Sep 14 19:49:00 UTC 2022


On Wed, 14 Sep 2022 03:14:33 GMT, Mark Powers <mpowers at openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java line 289:
>> 
>>> 287:             }
>>> 288: 
>>> 289:             // Can't figure this out, bail.
>> 
>> Maybe we should instead check if `namedParams` is null on line 286 and avoid the NPE there.
>
> Fixed. Throwing exception sooner rather than later.

Some final comments.

1. Move the definition of `namedParams` inside the if block it is used and merge with the assignment line.
2. Change `if (ecParams == null)` to `else`, and then there is no need to assign an initial value to `namedGroup`.

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

PR: https://git.openjdk.org/jdk/pull/9972



More information about the security-dev mailing list