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

Jaikiran Pai jpai at openjdk.org
Fri Sep 12 10:40:22 UTC 2025


On Tue, 9 Sep 2025 23:04:41 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.

src/java.base/share/classes/java/nio/file/SecureDirectoryStream.java line 199:

> 197:      * by the {@code targetdir} parameter, unless {@code targetdir} is
> 198:      * {@code null}, in which case it is located relative to the current
> 199:      * working directory. In all cases, if the target file exists then it is

Hello Brian, This is the first time I'm seeing this interface so I have some very basic questions. Is there a difference between working directory and open directory in context of this interface? The class level javadoc and several other places of this interface use "open directory" as a term to specify the semantics of these methods.

I'm a bit surprised by this interface in general. It has a type parameter `T` and also these methods work on that type, and `T` can be anything and not just a `java.nio.file.Path` type. But this entire interface appears to be for `Path` based operations:


public interface SecureDirectoryStream<T>
    extends DirectoryStream<T>
...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27178#discussion_r2343803297


More information about the nio-dev mailing list