Code Review Request: 7035556 DatagramSocket.java:183: warning: unreachable catch clause

Chris Hegarty chris.hegarty at oracle.com
Fri Jul 22 06:49:04 PDT 2011


On 7/22/2011 2:41 PM, Michael McMahon wrote:
> On 22/07/11 13:51, Chris Hegarty wrote:
>> On 7/22/2011 3:45 AM, Alan Bateman wrote:
>>> Kurchi Hazra wrote:
>>>> Hi,
>>>>
>>>> Due to a recent update in javac to issue a warning on detecting 
>>>> unreachable code, the following warning started showing up in the 
>>>> jdk networking code:
>>>> ../../../src/share/classes/java/net/DatagramSocket.java:183: 
>>>> warning: unreachable catch clause.
>>>>
>>>> This fix aims at removing this warning by removing the IOException. 
>>>> On inspection, it was found that currently, the native code does 
>>>> not throw any IOException.
>>>>
>>>> The fix involves updates in:
>>>> jdk/src/share/classes/java/net/DatagramSocket.java
>>>>
>>>>
>>>> Webrev: http://cr.openjdk.java.net/~chegar/7035556/webrev.00/
>>>>
>>>> Thanks,
>>>> -Kurchi
>>> Kurchi - one suggestion is to close the UDP socket in the event that 
>>> the bind fails. That would be nicer than leaving it to the impl's 
>>> finalizer.
>>
>> Ah yes, makes sense. thanks for catching this Alan.
>>
> But, bind() already closes the impl internally before throwing the 
> exception.

Oh, I didn't notice this. Great, then your original comment stands ( 
simply remove all catches ).

-Chris.

>
> - Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20110722/1e3ef086/attachment.html 


More information about the net-dev mailing list