RFR: 8367284: (fs) Support current working directory target in SecureDirectoryStream.move [v2]

Alan Bateman alanb at openjdk.org
Tue Jan 13 06:44:45 UTC 2026


On Mon, 12 Jan 2026 20:57:24 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Change `java.nio.file.SecureDirectoryStream.move` so that, instead of throwing a `NullPointerException` if the `targetdir` parameter is `null`, it considers a non-absolute path passed via `targetpath` as being relative to the current working directory.
>
> Brian Burkhalter 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 four additional commits since the last revision:
> 
>  - 8367284: Update targetdir param verbiage to allow null
>  - Merge
>  - 8367284: Update test after all
>  - 8367284: (fs) Support current working directory target in SecureDirectoryStream.move

Update looks okay, will you create the CSR for this?

test/jdk/java/nio/file/DirectoryStream/SecureDS.java line 305:

> 303:             if (ds instanceof SecureDirectoryStream<Path> sds) {
> 304:                 sds.move(file, null, file);
> 305:                 if (!Files.exists(result))

I think drop the Files.exist check here, the Files.readString will give a better exception if the readString fails.

test/jdk/java/nio/file/DirectoryStream/SecureDS.java line 312:

> 310:                 throw new RuntimeException("Not a SecureDirectoryStream");
> 311:             }
> 312:             System.out.println("Success: \"" + TEXT + "\"");

Just FYI that none of the tests in this method print trace messages so this "Success: ..." will look a bit odd in the .jtr output, esp. with tests that are added after this one. Maybe a left over? Maybe future work to move this to a junit test.

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

PR Comment: https://git.openjdk.org/jdk/pull/27178#issuecomment-3742270016
PR Review Comment: https://git.openjdk.org/jdk/pull/27178#discussion_r2685051747
PR Review Comment: https://git.openjdk.org/jdk/pull/27178#discussion_r2685050138


More information about the nio-dev mailing list