RFR: 8368156: java/nio/file/Files/IsSameFile.java failing (win)
Jaikiran Pai
jpai at openjdk.org
Tue Sep 23 08:13:49 UTC 2025
On Mon, 22 Sep 2025 22:08:30 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Use try-with-resources to ensure that the FileSystem `zipfs` is closed when no longer needed. This fixes the issue at hand. Other changes are to simplify cleanup of test files.
test/jdk/java/nio/file/Files/IsSameFile.java line 158:
> 156: try (FileSystem zipfs = FileSystems.newFileSystem(b)) {
> 157: list = new ArrayList<Arguments>();
> 158: list.add(Arguments.of(false, a, zipfs.getPath(b.toString())));
Hello Brian, this returns a collection which contains a `Path` that is obtained from a `FileSystem` that gets closed before the `Path` is used in the test method. Looking at the specification of `FileSystem.getPath()` I don't see any text which states the behaviour of `Path` instances after the `FileSystem` has been closed. I think we would be relying on unspecified behaviour here. Would it be better to refactor this a bit so that the `FileSystem` gets closed after the test(s) are complete?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27440#discussion_r2371521888
More information about the nio-dev
mailing list