RFR: JDK-8134577 - Eliminate or standardize a replacement for sun.net.spi.nameservice.NameServiceDescriptor

Artem Smotrakov artem.smotrakov at oracle.com
Mon Oct 26 00:24:07 UTC 2015

Hi Mark,

I am not a reviewer, just have a couple of comments about InetAddress.java

1. It may be better to create an instance of Scanner in 
try-with-resource block to be sure that Scanner.close() method is called.

2. Lines 909-923:

There are two similar "if" blocks in the loop. Looks like the first one 
is not necessary (I also see similar code in lookupAllHostAddr() method, 
maybe this code could be moved to a separate method).

3. extractHostAddr() and extractHost() methods:

The methods assume that "hostEntry" contains at least one whitespace, 
and access first and second elements of "mapping " array. It may be 
better to check that length of "mapping" is more than one to avoid a 
possible ArrayIndexOutOfBoundsException.

Looks like those methods may also be static.


On 10/26/2015 02:32 AM, Mark Sheppard wrote:
> Hi,
>    please oblige and review the following changes
> http://cr.openjdk.java.net/~msheppar/8134577/webrev/
> which address the issue raised in
> https://bugs.openjdk.java.net/browse/JDK-8134577
> the operative word has been "eliminate".
> As such, the interface and service descriptor 
> sun.net.spi.nameservice.NameService
> sun.net.spi.nameservice.NameServiceDescriptor*
> *together with its implementation (sun.net.nameservice.dns.DNSNameService)
> has been remove from the JDK libraries.
> The immediate impact is seen in the JDK testing framework.
> To facilitate testing activity, and provide a replacement for the 
> customized NameService implementations in the
> JDK tests,  the default NameService has been extended to support
> the retrieval of host to IP address mappings from a file.
> The file path is specified with a system property " jdk.internal.hosts".
> Previously a nameservice provider was specified by setting the system 
> property
> "sun.net.spi.nameservice.provider.", as per the documentation
> http://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html
> InetAddress now tests to determine if this property is set and will 
> throw a ServiceConfigurationError
> indicating that this functionality is no longer supported. The choice 
> of ServideConfigurationError may cause
> some debate, or disagreement. The rationale was that InternalError,  
> is documented to relate to a JVM error,
> and javax.naming.NamingException has a context of DirContext.
> A possible alternative candidate could be 
> javax.naming.ServiceUnavailableException.
> As such, the setting of the property 
> "sun.net.spi.nameservice.provider." was used, previously, as a 
> configuration
> parameter for the loading of a NamerService service provider, and as 
> this is now (considered) an error, ServiceConfigurationError,
> seemed a best fit!
> These changes impacted a number of jdk security tests, also. The 
> affected tetsts have been amended to adopt the
> changes, with the exception of 
> test/sun/security/x509/URICertStore/ExtensionsWithLDAP.java
> which will require some rewrite.
> regards
> Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/security-dev/attachments/20151026/cd50f1d7/attachment-0001.html>

More information about the security-dev mailing list