RFR: 8322881: java/nio/file/Files/CopyMoveVariations.java fails with AccessDeniedException due to permissions of files in /tmp [v4]
yaqsun
duke at openjdk.org
Fri Feb 23 06:29:55 UTC 2024
On Thu, 22 Feb 2024 17:32:22 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Could you change `tmp` to be a constant, for example
>
> ```
> private static final Path CURRENT_DIR;
> ```
74 try {
75 currentDir = Files.createTempFile(Path.of("."), "this", "that");
76 SUPPORTS_POSIX_PERMISSIONS =
77 Files.getFileStore(currentDir).supportsFileAttributeView("posix");
78 } catch (IOException cause) {
79 throw new UncheckedIOException(cause);
80 } finally {
81 if (currentDir != null) {
After change tmp to be a constant currentDir, variable currentDir can not be initialized in the finally block.
private static final Path currentDir;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17235#discussion_r1500251887
More information about the nio-dev
mailing list