8198753: (dc) DatagramChannel throws unspecified exceptions

Alan Bateman Alan.Bateman at oracle.com
Tue Mar 20 07:56:34 UTC 2018


On 19/03/2018 20:18, Brian Burkhalter wrote:
>
> I noticed that send() also needs to declare that it throws 
> UnresolvedAddressException and UnsupportedAddressTypeException.
Good, I agree we should fix this too.

The changes to the API + implementation looks right. One suggestion for 
the ordering of the exceptions is to move the AlreadyConnectedException 
up a bit so that ClosedChannelException and AsynchronousCloseException 
follow each other.


>
> java/nio/channels/DatagramChannel/SendToUnresolved.java already tests 
> for the UnresolvedAddressException of send(). The other exceptions do 
> not have test coverage. I modified ConnectedSend to test for these and 
> to use TestNG:
>
> http://cr.openjdk.java.net/~bpb/8198753/webrev.01/ 
> <http://cr.openjdk.java.net/%7Ebpb/8198753/webrev.01/>
>
> Perhaps I should pull the single test done in SendToUnresolved into 
> ConnectedSend (with bug ID) and remove SendToUnresolved altogether?
ConnectedSend was created to test send with a connected datagram channel 
so it will need to be renamed and its summary changed if extended to 
test both connect and send. I think it would be easier to maintain if 
they were separate tests. Also as you are moving these to TestNG then 
the specific tests cases can be very small. DatagramChannel has a bind 
method so you don't need to use the socket adapter to bind.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180320/47ff6e65/attachment-0001.html>


More information about the nio-dev mailing list