Skip to content

Latest commit

 

History

History
23 lines (11 loc) · 1.18 KB

README.md

File metadata and controls

23 lines (11 loc) · 1.18 KB

code

FakeDNS

FakeDNSTest

run with JVM options --add-opens java.base/java.net=ALL-UNNAMED

https://git1-us-west.apache.org/repos/asf?p=kudu.git;a=blob;f=java/kudu-client/src/test/java/org/apache/kudu/client/FakeDNS.java;hb=HEAD

https://bugs.openjdk.java.net/browse/JDK-8176361 Previous JDK releases documented how to configure java.net.InetAddress to use the JNDI DNS service provider as the name service. This mechanism, and the system properties to configure it, have been removed in JDK 9

A new mechanism to configure the use of a hosts file has been introduced.

A new system property jdk.net.hosts.file has been defined. When this system property is set, the name and address resolution calls of InetAddress, i.e getByXXX, retrieve the relevant mapping from the specified file. The structure of this file is equivalent to that of the /etc/hosts file.

When the system property jdk.net.hosts.file is set, and the specified file doesn't exist, the name or address lookup will result in an UnknownHostException. Thus, a non existent hosts file is handled as if the file is empty.

https://blog.codefx.org/java/five-command-line-options-to-hack-the-java-9-module-system/