8198753: (dc) DatagramChannel throws unspecified exceptions

Brian Burkhalter brian.burkhalter at oracle.com
Tue Mar 20 19:20:50 UTC 2018


On Mar 20, 2018, at 12:56 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> 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.

So changed for both connect() and send().

>> 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/
>> 
>> 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.


Test updates:

1. ConnectedSend reverted aside from conversion to TestNG.
2. ConnectExceptions and SendExceptions added to cover the newly documented exceptions.
3. SendToUnresolved removed as this is now tested SendExceptions which also includes the @bug ID from SendToUnresolved.

http://cr.openjdk.java.net/~bpb/8198753/webrev.02/

Thanks,

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


More information about the nio-dev mailing list