RFR: 8262742: (fs) Add Path::resolve with varargs string [v2]
Roger Riggs
rriggs at openjdk.org
Tue Jul 11 21:18:13 UTC 2023
On Mon, 10 Jul 2023 16:20:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Add to `java.nio.file.Path` methods which allow resolution of multiple descendants.
>
> Brian Burkhalter has updated the pull request incrementally with two additional commits since the last revision:
>
> - 8262742: Fix typo
> - 8262742: Remove invalid "throws InvalidPathException"; correct typo
src/java.base/share/classes/java/nio/file/Path.java line 520:
> 518:
> 519: /**
> 520: * Resolves a path or a sequence of paths against this path.
"or" -> "and then"
src/java.base/share/classes/java/nio/file/Path.java line 574:
> 572: * Path result = resolve(first);
> 573: * for (String s : more) {
> 574: * result = result.resolve(s);
The code here doesn't match the description, converts to Paths and then resolves.
Though it might not be detectable.
src/java.base/share/classes/java/nio/file/Path.java line 586:
> 584: * @throws InvalidPathException
> 585: * if the path string cannot be converted to a Path.
> 586: *
When an InvalidPathException is thrown, what information is available to identify the illegal string?
"if the path" -> "if a path" or "if any of the paths".
test/jdk/java/nio/file/Path/PathOps.java line 1728:
> 1726: .resolve("/foo", "", "foo")
> 1727: .resolve("/bar", "foo", "", "/bar");
> 1728:
Should there be test cases that include multiple directories in a path: "abc/def/xyz"?
Also cases with "..", or is that only relevant if canonicalizing.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1260285130
PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1260285994
PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1260282403
PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1260290443
More information about the nio-dev
mailing list