RFR: 7180557 - InetAddress.getLocalHost throws UnknownHostException on java7u5 on OSX

Bernd Eckenfels bernd-2013 at eckenfels.net
Fri Sep 13 12:28:44 PDT 2013


Am 13.09.2013, 19:32 Uhr, schrieb Rob McKenna <rob.mckenna at oracle.com>:
> W.r.t. the use of AI_CANONNAME, this doesn't actually make a difference  
> in the context of this fix, but is definitely something that should be  
> looked at. I'll put it on the todo list.

I think it does make a difference: If you remove the CANON flag  
getaddrinfo() will not do DNS lookups when the host is configured to  
prefer the hosts file (which it should do on Linux and OSX). And so the  
platform specific lookupIfLocalhost() can be put after the getaddrinfo()  
(again).

I actually think the bug "exists" on all platforms. If getaddrinfo() fails  
because neighter hosts nor DNS file finds the name this can happen on all  
platforms. I dont think it helps to add a fallback only on MACOSX (and  
there is certainly no need to prefer the fallback then).

Gruss
Bernd



More information about the net-dev mailing list