<net-dev> Java_java_net_Inet6AddressImpl_isReachable0 is returning false for InetAdress 0.0.0.0

Alan Bateman Alan.Bateman at oracle.com
Wed Apr 25 02:15:00 PDT 2012


On 25/04/2012 07:18, Deven You wrote:
> Hi Michael,
>
> I also add the bug number into the test case[1], please review it:
>
> [1] http://cr.openjdk.java.net/~youdwei/inet4adr/webrev.01/
It's in the bug database as:

7163874: InetAddress.isReachable should support pinging 0.0.0.0

My take on this is that this is not really a bug as it's going to 
platform specific as to whether the native ping tool will special-case 
this address. However I don't object to handling special-casing this 
address. Have you thought about ::0 too and have you thought about 
clarifying the javadoc so that developers have some expectation as to 
how this method should behave when invoked on this address?

A couple of comments on the test:

- how about changing it to PingThis.java? (Javanet.java is a bit too 
generic).

- I think Chris mentioned this already but the indent is a bit odd too.

- I would suggest changing " 
Java_java_net_Inet6AddressImpl_isReachable0" in the @summary to 
"InetAddress.isReachable".

- I'd suggest renaming "b" to "isReachable" and then you can do "if 
(isReachable) ..." which is more readable than "if (b == true) ..."

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/net-dev/attachments/20120425/9a03c501/attachment.html 


More information about the net-dev mailing list