On Wed, 20 Nov 2024 14:58:36 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> Volkan Yazıcı has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains eight commits: >> >> - Merge master >> - Catch all `bind()` and `connect()` exceptions in ctor >> - Use safe-`close()` before throwing `UHE` in `connect()` >> - Update docs for `connect()` not closing on `UHE` >> - Incorporate more review feedback >> - Apply review feedback from Alan >> - Apply review suggestions by Alan & Daniel >> - 8343791: Close `Socket` on `connect()` failures > > src/java.base/share/classes/java/net/Socket.java line 573: > >> 571: * >> 572: * <p> If the connection cannot be established, then the socket is >> closed >> 573: * and an {@link IOException} is thrown. > > What happened to "the endpoint is an unresolved InetSocketAddress"? If part > of the change is to close when called with an unresolved address then it > needs to be part of the specification. Fixed in 0761b36297679c9cdea65191f34189b3f51169b0. > src/java.base/share/classes/java/net/Socket.java line 661: > >> 659: >> 660: if (epoint.isUnresolved()) { >> 661: UnknownHostException exception = new >> UnknownHostException(epoint.getHostName() + " is unresolved"); > > In passing, if you replace this with `var uhe = new > UnknownHostException(...)` then the later "throw uhe` will be clearer than > `throw exception`. Fixed in 92ef9ebb8eff8d6972d5363bdce6b88f55c4a7c4. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1850513963 PR Review Comment: https://git.openjdk.org/jdk/pull/22160#discussion_r1850514096