RFR: 7116990: (spec) Socket.connect(addr,timeout) not clear if IOException because of TCP timeout

Jaikiran Pai jpai at openjdk.org
Mon Jun 9 07:44:32 UTC 2025


Can I please get a review of this doc-only change which proposes to add a `@apiNote` to the `Socket.connect(SocketAddress endpoint, int timeout)` method? This addresses https://bugs.openjdk.org/browse/JDK-7116990.

As noted in that issue, users can find it surprising that when the `Socket.connect(...)` method is called with a `timeout` value, then if that timeout value happens to be greater than the connect timeout that operating systems typically impose, then a `IOException` gets thrown instead of the `SocketTimeoutException`. The change in this PR proposes to add a `@apiNote` which explains this current behaviour.

If this requires a CSR, I'll open one once we settle on the proposed text.

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

Commit messages:
 - 7116990: (spec) Socket.connect(addr,timeout) not clear if IOException because of TCP timeout

Changes: https://git.openjdk.org/jdk/pull/25690/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25690&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-7116990
  Stats: 6 lines in 1 file changed: 6 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/25690.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25690/head:pull/25690

PR: https://git.openjdk.org/jdk/pull/25690


More information about the net-dev mailing list