On Thu, 16 Apr 2026 17:55:13 GMT, Artur Barashev <[email protected]> wrote:

>> `InterruptedIOException` is being deprecated, replace it with 
>> `SocketTimeoutException` in SSL code.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> 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;
        };

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

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

Reply via email to