Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8262195

Harden tests that use the HostsFileNameService (jdk.net.hosts.file property)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • None
    • core-libs
    • b12
    • linux, os_x, windows

      Intermittent failures have been observed across java.net that are related to use of System.setproperty("jdk.net.hosts.file") to configure the use of the HostsFileNameService. This is causing issues as it is possible for certain JVM tools to access InetAddress and initialise it's static members (such as nameService and impl) during start-up resulting in a Name Service configuration being already set to the default PlatformNameService by the the time a test run is commenced.

      These intermittent failures can be resolved by setting the relevant system property (jdk.net.hosts.file) in the run tag of the jtreg test arguments. This provides certainty that the correct system properties will be set by the time the test is run.

      The following tests are concerned with this issue:
      java/net/Inet4Address/textToNumericFormat.java
      java/net/InetAddress/InternalNameServiceWithNoHostsFileTest.java
      java/net/InetAddress/InternalNameServiceWithHostsFileTest.java
      java/net/InetAddress/InternalNameServiceTest.java
      java/net/URLPermission/nstest/LookupTest.java
      sun/net/InetAddress/nameservice/simple/DefaultCaching.java
      sun/net/InetAddress/nameservice/simple/CacheTest.java

        There are no Sub-Tasks for this issue.

            ccleary Conor Cleary (Inactive)
            ccleary Conor Cleary (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: