RFR: 8336815: Socket.bind/connect and ServerSocket.bind/accept do not specify behavior when already bound, connected or closed

Alan Bateman alanb at openjdk.org
Sat Jul 20 08:27:31 UTC 2024


On Sat, 20 Jul 2024 08:22:20 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Can I please get a review of this change which updates the specification of a few methods in `java.net.Socket` and `java.net.ServerSocket` classes to specify the `IOException` that the implementation currently already throws?
>> 
>> This is merely a doc update and doesn't change the implementation.
>> 
>> Given that these exceptions can now be asserted, a new jtreg test has been introduced to verify the exceptions thrown from these APIs. The test passes. tier testing is currently in progress. I'll open a CSR shortly.
>
> src/java.base/share/classes/java/net/ServerSocket.java line 521:
> 
>> 519:      *
>> 520:      * @throws     IOException  if an I/O error occurs when waiting for a
>> 521:      *               connection, or if the socket isn't bound or is already closed.
> 
> Can you check the existing text as I think it uses "not bound" rather than "isn't bound".

Also "already close" might be a bit inconsistent with the existing API docs too, can you check as I think we use  "is closed" in most places.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20268#discussion_r1685320246


More information about the net-dev mailing list