RFR[8240533]: 'Inconsistent Exceptions are thrown by DatagramSocket and DatagramChannel when sending a DatagramPacket to port 0.'

Lance Andersen lance.andersen at oracle.com
Tue Mar 31 12:31:13 UTC 2020


Hi Patrick,

I think this looks OK.

I might suggest using assertThrows vs expectThrows.  While they are the same,  assertThrows seems more natural and consistent with the other testNG assert methods.

HTH

Best
Lance

> On Mar 31, 2020, at 6:15 AM, Patrick Concannon <patrick.concannon at oracle.com> wrote:
> 
> Hi,
> 
> Could someone please review my fix for JDK-8240533 'Inconsistent Exceptions are thrown by DatagramSocket and DatagramChannel when sending a DatagramPacket to port 0.' ?
> 
> Currently, DatagramSocket throws an IOException when sending to port 0, and doesn't throw when connecting. DatagramChannel currently throws a BindException in both cases.
> The fix adds checks for port == 0 to the send and connect methods in DatagramSocket and DatagramChannelImpl. This is to ensure that consistent Exceptions i.e. SocketExceptions are thrown when trying to connect or send to port 0.
> 
> 
> bug: https://bugs.openjdk.java.net/browse/JDK-8240533
> webrev: http://cr.openjdk.java.net/~pconcannon/8240533/webrevs/webrev.00/
> 
> 
> Kind regards,
> 
> Patrick

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200331/dd149af0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oracle_sig_logo.gif
Type: image/gif
Size: 658 bytes
Desc: not available
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200331/dd149af0/oracle_sig_logo.gif>


More information about the nio-dev mailing list