Files.isWritable returning false for network paths
Please provide a brief summary of the bug
We are using openjdk version "17.0.6" 2023-01-17. OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing) in windows machine.
For a network samba shared path, Files.isWritable is returning false. Actually I have full access to the path. I am able to create subdirectory and files using command prompt / explorer.
I also observer path.toFile().canWrite() returns true for that shared path.
We have issues wherver we use Files.isWritable for network shared paths
Please provide steps to reproduce where possible
package Testing;
import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths;
public class FilesIsWritableTest { public static void main(String[] args) {
String f1 = "x:/yylmssysdm/zzzz";
Path p = Paths.get(f1);
System.out.println(Files.isWritable(p));
System.out.println(p.toFile().canWrite());
}
}
Expected Results
true true
Actual Results
false true
What Java Version are you using?
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
What is your operating system and platform?
Microsoft Windows [Version 10.0.19045.2604]
How did you install Java?
MSI
Did it work before?
No
Did you test with the latest update version?
Yes
Did you test with other Java versions?
Tested with Java 17 also. Fails there
Relevant log output
No response
Java version is OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
Looks like https://bugs.openjdk.org/browse/JDK-8154915?jql=text%20~%20%22Files.isWritable%22
https://bugs.openjdk.org/browse/JDK-8154915 has this ask:
It would be useful if the submitter could try Files.readAttributes(path, BasicFileAttributes.class) and
report back so to whether it succeeds or throws exception. If there is an exception then it might
reveal an issue in the environment.
@nsrg ^^
https://bugs.openjdk.org/browse/JDK-8154915 has this ask:
It would be useful if the submitter could try Files.readAttributes(path, BasicFileAttributes.class) and report back so to whether it succeeds or throws exception. If there is an exception then it might reveal an issue in the environment.
Tried Files.readAttributes(path, BasicFileAttributes.class) ; It does does not throw exception.
We are marking this issue as stale because it has not been updated for a while. This is just a way to keep the support issues queue manageable. It will be closed soon unless the stale label is removed by a committer, or a new comment is made.