RFR: 8316000: File.setExecutable silently fails if file does not exist
Brian Burkhalter
bpb at openjdk.org
Tue Sep 12 01:39:40 UTC 2023
On Mon, 11 Sep 2023 22:22:47 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> On Windows, do not return `true` from the `java.io.File` methods `setReadable(boolean, boolean)` and `setExecutable(boolean, boolean)` if the file does not exist.
src/java.base/windows/native/libjava/WinNTFileSystem_md.c line 479:
> 477: if (access == java_io_FileSystem_ACCESS_READ ||
> 478: access == java_io_FileSystem_ACCESS_EXECUTE) {
> 479: return _waccess(pathbuf, 0) == 0 ? enable : JNI_FALSE;
Here `enable` is returned for backward compatibility, but per the specification it seems that `JNI_TRUE` should be returned instead.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15673#discussion_r1322263371
More information about the core-libs-dev
mailing list