RFR: 8262862: Harden tests sun/security/x509/URICertStore/ExtensionsWithLDAP.java and krb5/canonicalize/Test.java

Fernando Guallini fguallini at openjdk.java.net
Wed Mar 3 12:28:04 UTC 2021


Certain JVM tools may access and initialise InetAddress class and its static fields during start up resulting in a NameService implementation being already set to the default **PlatformNameService**, causing intermittent failures in some tests that expect the use of **HostsFileNameService** instead by setting the system property jdk.net.hosts.file in the test main body, which has no effect in this scenario

By setting the property **jdk.net.hosts.file** in the @run tag, there is certainty that it will be properly configured at the time that a [NameService](https://github.com/openjdk/jdk/blob/382e38dd246596ec94a1f1ce0e0f9e87f53366c7/src/java.base/share/classes/java/net/InetAddress.java#L1155) is created

-------------

Commit messages:
 - remove indentation
 - Improve tests that use HostsFileNameService (jdk.net.hosts.file property)

Changes: https://git.openjdk.java.net/jdk/pull/2809/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2809&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262862
  Stats: 20 lines in 2 files changed: 3 ins; 12 del; 5 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2809.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2809/head:pull/2809

PR: https://git.openjdk.java.net/jdk/pull/2809



More information about the security-dev mailing list