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

(dc) DatagramChannel throws unspecified exceptions

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      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.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: