Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8198753

(dc) DatagramChannel throws unspecified exceptions

    Details

    • Subcomponent:
    • Resolved In Build:
      b07
    • Verification:
      Not verified

      Description

      The connect method does not specify the exception to be thrown when the datagram channel is already connected. It has historically thrown IllegalStateException. In JDK 11 it throws the more specific AlreadyConnectedException (which seems the best choice to specify).

      Another issue with connect is that it doesn't specify UnsupportedAddressTypeException and UnresolvedAddressException. We need to get this consistent with SocketChannel.connect.

      Invoking the send on a datagram channel that is connected is likely a user error. The implementation has historically allowed this method to be used when send to the address that the channel is connected (as this case is benign). It has thrown IllegalArgumentException if the datagram channel is connected to a different target address. Neither case was specified. We should keep existing behavior when sending to the address that the channel is connected too. AlreadyConnectedException may be a better exception for the case that the channel is connected and the user is attempting to send to a different address.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                alanb Alan Bateman
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: