RFR: 8336817: DatagramSocket.connect does not specify behavior when already connected

Alan Bateman alanb at openjdk.org
Tue Aug 13 08:19:49 UTC 2024


On Mon, 12 Aug 2024 08:18:17 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this doc-only change which updates the javadoc on several methods of the `java.net.DatagramSocket` class to match its current implementation?
> 
> This addresses https://bugs.openjdk.org/browse/JDK-8336817.
> 
> I'll open a CSR once we settle on the proposed text.

src/java.base/share/classes/java/net/DatagramSocket.java line 427:

> 425:      * <p> If this socket is already connected, then this method will attempt to
> 426:      * connect to the passed address and if that attempt completes exceptionally,
> 427:      * then this socket will continue to be connected to the previously connected address.

I don't know if there are other implementations DatagramSocketImpl in the eco system but the text could potentially invalidate them.  I think it would be better to say that if connect fails then the state of the DatagramSocket is unknown, it may or may not be connected to the address that it was previously connected to.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20543#discussion_r1714871554


More information about the net-dev mailing list