RFR: 8336815: Several methods in java.net.Socket and ServerSocket do not specify behavior when already bound, connected or closed [v5]

Alan Bateman alanb at openjdk.org
Wed Jul 24 11:12:33 UTC 2024


On Wed, 24 Jul 2024 11:03:50 GMT, Jaikiran Pai <jpai 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.
>
> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
> 
>   add Joe's suggestion to the close() methods

src/java.base/share/classes/java/net/ServerSocket.java line 739:

> 737:      * as well.
> 738:      *
> 739:      * <p>Once closed, several of the methods defined by this class will throw

The existing paragraphs use "<p> ", probably want to keep it consistent to avoid mixing styes in the one method.

src/java.base/share/classes/java/net/Socket.java line 1737:

> 1735:      * Once a socket has been closed, it is not available for further networking
> 1736:      * use (i.e. can't be reconnected or rebound) and several of the methods defined
> 1737:      * by this class will throw an exception when invoked on the closed socket. A new

I think "if invoked" might be better than "when invoked" here

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

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


More information about the net-dev mailing list