RFR: 8259223: Simplify boolean expression in the SunJSSE provider
Sean Mullan
mullan at openjdk.java.net
Tue Jan 5 14:12:57 UTC 2021
On Tue, 5 Jan 2021 07:06:42 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
> There are some boolean expressions that could be improved for better readability in the SunJSSE provider implementation. For example:
>
> - if (cert instanceof X509Certificate == false) {
> + if (!(cert instanceof X509Certificate)) {
>
> - return isDTLS ? true : (id >= TLS10.id);
> + return isDTLS || (id >= TLS10.id);
>
>
> Code cleanup, no new regression test.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8259223
Marked as reviewed by mullan (Reviewer).
src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java line 823:
> 821: preferred = true;
> 822: }
> 823: if (preferred && (!findAll)) {
Minor comment - remove the parenthesis around !findAll.
src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java line 617:
> 615: // for now until there are signs that this check
> 616: // causes problems for real world EC certificates.
> 617: if ((this == SERVER) && (!getBit(ku, 4))) {
You could remove the inner parenthesis around `this == SERVER` and `!getBit(ku, 4)`, which would make it consistent with the style used on line 584.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1942
More information about the security-dev
mailing list