RFR: 8376290: SocketChannel.finishConnect() contains confusing "getsockopt" in exception message for a failed connect() on Windows [v4]

Alan Bateman alanb at openjdk.org
Mon Jan 26 19:37:12 UTC 2026


On Mon, 26 Jan 2026 14:03:16 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Can I please get a review of this change which proposes to remove the confusing "getsockopt" text from the exception reported on Windows when `SocketChannel.finishConnect()` raises an exception due to a failed `connect()`? 
>> 
>> This addresses https://bugs.openjdk.org/browse/JDK-8376290 and as noted in that issue, this looks like an oversight when changes were done for https://bugs.openjdk.org/browse/JDK-8317603. Prior to that, on older versions the exception reported on Windows was:
>> 
>> 
>> java.net.ConnectException: Connection refused: no further information
>> 
>> 
>> With the current proposed changes in this PR, the exception will now be `java.net.ConnectException: Connection refused` which matches what we report on *nix platforms.
>> 
>> A new jtreg test has been added to reproduce the original text and verify the change. tier1, tier2 and tier3 continue to pass with this change.
>
> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   replace TestAbortedException with Assumptions.assumeTrue

Marked as reviewed by alanb (Reviewer).

test/jdk/java/nio/channels/Selector/ConnectionRefusedMessage.java line 91:

> 89:                         assumeTrue(success, "unexpectedly connected to " + destAddr);
> 90:                     }
> 91:                     fail("ConnectException was not thrown");

The test is fine, I'm just curious why the assumeTrue is predicated on success being true, is this left over from the previous iteration? If it is removed then the fail goes away too.

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

PR Review: https://git.openjdk.org/jdk/pull/29409#pullrequestreview-3707652821
PR Review Comment: https://git.openjdk.org/jdk/pull/29409#discussion_r2728960365


More information about the net-dev mailing list