RFR: 8355475: UNCTest should use an existing UNC path [v2]

Daniel Fuchs dfuchs at openjdk.org
Thu Apr 24 17:47:55 UTC 2025


On Thu, 24 Apr 2025 17:42:44 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

>> Please review this test-only PR which updates `UNCTest.java` to use a UNC path which is known to exist.
>> 
>> The test currently uses the file URL `file://jdk/LOCAL-JAVA/jdk1.4/win/README.txt`, but since this is unlikely to resolve to an existing UNC path on any CI server, the test doesn't really verify what it intended to.
>> 
>> This PR changes the test to instead use the path `file://computername/C$/Windows`, which should always be available unless Administrative Shares has been disabled. We detect this case by using File::exists for the path and simply skip the test if it does not exist.
>> 
>> I forced this test to run in tier1 on GHA and verified that it ran successfully, without being skipped. Meaning Administrative Shares is enabled in the Windows GHA instance.
>> 
>> A test run in Oracle's CI verifying a successful run (without skipping) would be welcome.
>> 
>> This is a test only PR, `noreg-self` has been added in the JBS.
>
> Eirik Bjørsnøs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Cleanups suggested in review
>  - Merge branch 'master' into unc-test-existing-path
>  - UNCTest should use an existing UNC path

test/jdk/java/net/URLConnection/UNCTest.java line 57:

> 55:         // File URL for the UNC path
> 56:         URL url = new URI("file:" + path.replace('\\', '/')).toURL();
> 57: 

My gut feeling is that using `path.replace` here makes what's going on more obscure. I would keep the original string: `"file://" + hostName +"/C$/Windows"`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24842#discussion_r2058946721


More information about the net-dev mailing list