RFR: 8244958: preferIPv4Stack and preferIPv6Addresses do not affect addresses returned by HostsFileNameService
Daniel Fuchs
daniel.fuchs at oracle.com
Fri May 22 18:40:44 UTC 2020
Hi Aleksei,
I believe I'd prefer to move these two lines:
322 String prefer4 =
GetPropertyAction.privilegedGetProperty("java.net.preferIPv4Stack");
323 onlyIPv4Addresses = Boolean.parseBoolean(prefer4);
324
(and the declaration of onlyIPv4Addresses)
to the HostsFileNameService class since that's the only place where
it's used.
Also I'd suggest to rename `onlyIPv4Addresses` to `preferIPv4Stack` to
stay consistent. I'm not a great fan of inserting a blank before []
either, but I see it seems to be a recurrent feature in this file so
I agree to abide with this style here for consistency (though it hurts
my eyes ;-) )
Otherwise looks good to me.
best regards,
-- daniel
On 22/05/2020 16:45, Aleks Efimov wrote:
> Hi,
>
> The "java.net.preferIPv4Stack" and "java.net.preferIPv6Addresses" system
> properties do not affect the addresses and their order, returned by the
> HostsFileNameService provider that can be created by specifying
> "jdk.net.hosts.file" system property.
> The following fix analyses the system properties and re-orders/filters
> the returned IP addresses, if needed. Plus, small clean-up changes:
> http://cr.openjdk.java.net/~aefimov/8244958/00
>
> JBS:
> https://bugs.openjdk.java.net/browse/JDK-8244958
>
> Networking tests from regression and JCK suites show no failures
>
> With Best Regards,
> Aleksei
More information about the net-dev
mailing list