On Thu, 21 Nov 2024 10:01:57 GMT, Alan Bateman <[email protected]> wrote:
>> Volkan Yazıcı has updated the pull request incrementally with four
>> additional commits since the last revision:
>>
>> - Revert `UHE` message change in `NioSocketImpl`
>> - Remove self-reference guard in `closeSuppressingExceptions()`
>> - Add back incorrectly removed `SocketTimeoutException` Javadoc
>> - Remove unused `port` variable
>
> src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java line 612:
>
>> 610: close();
>> 611: if (ioe instanceof InterruptedIOException) {
>> 612: throw new SocketException("Closed by interrupt");
>
> SocketTimeoutException is InterruptedIOException so need to distinguish this
> from the case where a virtual thread is interrupt during connect. The change
> for NioSocketImpl needs to be like this (once exception handle in switch
> comes then we can improve this).
>
>
> }
> } catch (IOException ioe) {
> close();
> - if (ioe instanceof InterruptedIOException) {
> + if (ioe instanceof SocketTimeoutException) {
> throw ioe;
> + } else if (ioe instanceof InterruptedIOException) {
> + assert Thread.currentThread().isVirtual();
> + throw new SocketException("Closed by interrupt");
> } else {
> throw SocketExceptions.of(ioe, isa);
> }
Fixed in 9f00f61d3b7fa42a5e23a04f80bb4bb1a2076ef2.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1851813826