Details
-
Bug
-
Resolution: Fixed
-
P3
-
13
-
b20
-
x86
-
windows_10
Description
jdeps uses `Files.isWritable(Path)` in `JdepsTask.java` to validate a user-given target path for generated dot and/or module-info.java files.
That `Files.isWritable(Path)` method returns `false` on Windows, although the given path represents a directory the current user has write access to.
Here's an example for the default "C:\" root directory:
jshell> Path.of("C:\\").toFile().canWrite()
$10 ==> true
jshell> Files.isWritable(Path.of("C:\\"))
$11 ==> false
Here are the two usages of `Files.isWritable(Path)`:
- https://github.com/openjdk/jdk/blob/7256d38458190c2e538b1082dcaca575f2dd5d6d/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java#L614
- https://github.com/openjdk/jdk/blob/7256d38458190c2e538b1082dcaca575f2dd5d6d/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java#L621
Workaround:
Provide a non-existing directory to take the first exit of the two `if`-clauses linked above to by-pass the call of `Files.isWritable(Path)`.
That `Files.isWritable(Path)` method returns `false` on Windows, although the given path represents a directory the current user has write access to.
Here's an example for the default "C:\" root directory:
jshell> Path.of("C:\\").toFile().canWrite()
$10 ==> true
jshell> Files.isWritable(Path.of("C:\\"))
$11 ==> false
Here are the two usages of `Files.isWritable(Path)`:
- https://github.com/openjdk/jdk/blob/7256d38458190c2e538b1082dcaca575f2dd5d6d/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java#L614
- https://github.com/openjdk/jdk/blob/7256d38458190c2e538b1082dcaca575f2dd5d6d/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsTask.java#L621
Workaround:
Provide a non-existing directory to take the first exit of the two `if`-clauses linked above to by-pass the call of `Files.isWritable(Path)`.
Attachments
Issue Links
- relates to
-
JDK-8130830 (fs) Files.isWritable method returns false when the path is writable (win)
- Open