RFR[8237890]: 'DatagramPacket::getSocketAddress doesn't specify what happens if address or port are not set'
Patrick Concannon
patrick.concannon at oracle.com
Wed Apr 15 15:40:39 UTC 2020
Hi Alan,
Thanks for your feedback. I've updated the fix with your comments and
you can find them in the new webrev below.
WRT the release note JDK-8237530
<https://bugs.openjdk.java.net/browse/JDK-8237530>, that's a good point.
I will look into removing it.
webrev: http://cr.openjdk.java.net/~pconcannon/8237890/webrevs/webrev.01/
Kind regards,
Patrick
On 10/04/2020 13:28, Alan Bateman wrote:
>
>
> On 10/04/2020 11:16, Patrick Concannon wrote:
>>
>> Hi,
>>
>> Could someone please review my webrev and CSR for JDK-8237890
>> 'DatagramPacket::getSocketAddress doesn't specify what happens if
>> address or port are not set' ?
>>
>> DatagramPacket::getSocketAddress is misleading in that it can throw
>> an IllegalArgumentException even though it doesn't take any
>> arguments. This can occur if the port of a DatagramPacket is not set
>> before a call to getSocketAddress is made.
>>
>> In the recent fixJDK-8236940
>> <https://bugs.openjdk.java.net/browse/JDK-8236940>, additional checks
>> were addedto ensure DatagramPacket cannot besent to port 0. Following
>> on from this update,the current fix changes the default port of a
>> DatagramPacket from -1 to 0. An IllegalArgumentException will
>> therefore no longer be thrown when getSocketAddress with no port set.
>> Instead, an InetSocketAddress representing any local address with
>> port 0 is returned.
>>
>>
>> bug: https://bugs.openjdk.java.net/browse/JDK-8237890
>> csr: https://bugs.openjdk.java.net/browse/JDK-8242483
>> webrev: http://cr.openjdk.java.net/~pconcannon/8237890/webrevs/webrev.00/
>>
> The default value for address and port are null and 0 (resp.) so you
> could just remove L93-94.
>
> In the getSocketAddress() spec it might be better to say "Returns"
> rather than "Gets" so that its consistent with the getAddress and
> getPort methods.
>
> Can you look at DatagramSocketAdaptor L202 where the comment is
> "throws IAE if port not set". I assume that comment should be removed.
>
> Do we need to re-visit or withdraw the release note JDK-8237530 as IAE
> is there is no longer a "port out of range" condition?
>
> -Alan
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20200415/91ada07d/attachment.htm>
More information about the net-dev
mailing list