On Thu, 16 Apr 2026 18:13:26 GMT, Alan Bateman <[email protected]> wrote:

>> Artur Barashev has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Use exception pattern matching
>
> src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java line 1689:
> 
>> 1687:             case IOException _ -> alert = Alert.UNEXPECTED_MESSAGE;
>> 1688:             default -> alert = Alert.INTERNAL_ERROR;
>> 1689:         }
> 
> If you want to go further then you could use an expression too, e.g.
> 
>         Alert alert = switch (cause) {
>             case SocketTimeoutException ste -> throw ste;
>             case SSLHandshakeException _ ->  Alert.HANDSHAKE_FAILURE;
>             case IOException _ ->  Alert.UNEXPECTED_MESSAGE;
>             default -> Alert.INTERNAL_ERROR;
>         };

Good point! All done, thanks!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30753#discussion_r3095539041

Reply via email to