RFR: 8262195: Harden tests that use the HostsFileNameService (jdk.net.hosts.file property) [v2]

Conor Cleary ccleary at openjdk.java.net
Thu Feb 25 19:19:43 UTC 2021


On Thu, 25 Feb 2021 17:26:00 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Conor Cleary has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - 8262195: Copyrights & InternalNSTest Host File Delete
>>  - 8262195: Added descriptive comments and filename
>
> test/jdk/java/net/InetAddress/InternalNameServiceWithNoHostsFileTest.java line 32:
> 
>> 30:  *          thrown
>> 31:  * @run main/othervm -Djdk.net.hosts.file=TestHosts-II -Dsun.net.inetaddr.ttl=0
>> 32:  *          InternalNameServiceWithNoHostsFileTest
> 
> shouldn't this be:
> 
> @run main/othervm -Djdk.net.hosts.file=${test.src}/TestHosts-II -Dsun.net.inetaddr.ttl=0

TestHosts-II was never in the test.src directory, from what I could tell it was just a dummy file (as per the test name) to verify the reaction when a Hosts File is not found. So, to be consistent with the other changes in this PR where a Host File is not present, I gave just the Filename in the path. Are there possible issues stemming from this? One I can think of is that a Hosts FIle of that name happens to be present in the user.dir though that is probably not very likely.

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

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


More information about the net-dev mailing list