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

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

    XMLWordPrintable

Details

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

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              ccleary Conor Cleary
              ccleary Conor Cleary
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: