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

(dc) DatagramChannel throws unspecified exceptions

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 11
    • core-libs
    • None
    • behavioral
    • minimal
    • Hide
      DatagramChannel connect has thrown these exceptions since JDK 1.4 so there is no behavior change to this method.

      DatagramChannel send has thrown IllegalArgumentException for the connected (to different target socket address) case since JDK 1.4. The proposal in this CSR is to throw AlreadyConnectedException to align it with the write method (and other methods in this API). It is highly unlikely that anything be dependent on the legacy and unspecified behavior.
      Show
      DatagramChannel connect has thrown these exceptions since JDK 1.4 so there is no behavior change to this method. DatagramChannel send has thrown IllegalArgumentException for the connected (to different target socket address) case since JDK 1.4. The proposal in this CSR is to throw AlreadyConnectedException to align it with the write method (and other methods in this API). It is highly unlikely that anything be dependent on the legacy and unspecified behavior.
    • Java API
    • SE

      Summary

      The java.nio.channels.DatagramChannel methods connect() and send() throw unspecified exceptions.

      Problem

      DatagramChannel.send may throw an unspecified IllegalArgumentException if the channel is already connected and its address parameter differs from the address to which the channel is connected. This exception should be changed to the more apt java.nio.channels.AlreadyConnectedException.

      After the foregoing change, both DatagramChannel.connect and DatagramChannel.send may throw java.nio.channels.AlreadyConnectedException, java.nio.channels.UnresolvedAddressException, or java.nio.channels.UnsupportedAddressTypeException, none of which are specified.

      Solution

      Update the DatagramChannel.connect and DatagramChannel.send documentation to specify that these methods may throw java.nio.channels.AlreadyConnectedException, java.nio.channels.UnresolvedAddressException, and java.nio.channels.UnsupportedAddressTypeException.

      Specification

      Please refer to the attached specdiff specdiff-dc-exceptions-8198753.zip.

            bpb Brian Burkhalter
            alanb Alan Bateman
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: