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:24:31 UTC 2024
On Sat, 20 Jul 2024 07:51:59 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.
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".
test/jdk/java/net/Socket/SocketBasicExceptionsTest.java line 40:
> 38: * @run junit SocketBasicExceptionsTest
> 39: */
> 40: public class SocketBasicExceptionsTest {
I would expect these exceptions are already test by existing tests for Socket and Server, can you check? Only asking because it looks a bit unusual to create a test for a small subset of the possible exceptions thrown by these classes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20268#discussion_r1685319926
PR Review Comment: https://git.openjdk.org/jdk/pull/20268#discussion_r1685319724
More information about the net-dev
mailing list