RFR: 8022445: fix RMISocketFactory example to avoid using localhost

Stuart Marks stuart.marks at oracle.com
Thu Aug 22 22:51:43 UTC 2013


On 8/22/13 6:48 AM, Alan Bateman wrote:
> On 22/08/2013 13:48, Bernd Eckenfels wrote:
>> getLoopbackAddress is either ::1 or 127.0.0.1 (depending on the stack
>> preferemces) and InetAddress.getByName("localhost") is also one of
>> both (but not necesarily the same, unfortunately). This happened to me
>> in the past, so I wanted to make sure that asumption does not show up
>> in sample code of JavaDocs. Thanks for improving this!
>>
> You're right, this method is returning a specific address. In that case,
> I think Chris's point about using the familiar (IPv4) is probably the
> way to go when changing this.

Thanks for looking at this.

I had initially used the IPv6 address since it's more forward-looking, 
but after reading the comments and after further reflection I'll change 
it to use an IPv4 loopback address.

s'marks



More information about the core-libs-dev mailing list