FULL PRODUCT VERSION :
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6002]
EXTRA RELEVANT SYSTEM CONFIGURATION :
non-administrative account
A DESCRIPTION OF THE PROBLEM :
Using FileSystemProvider.checkAccout (path, AccessMode.WRITE) throws an AccessDeniedException for 'path' if you work on a non-administrative account - but you can effectivly write the file denoted by 'path'.
As other code, especially Files.isWritable(path) is based on this, also this code is affected. The nice ZipFileSystem provided with Java 7 will open any zip-Files only in read-only mode, if you work with a non-administrative account.
If using an administrative account everything will be perfect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
static void testWriteAndWriteAccess() {
String filename = "test.txt";
Path path = Paths.get(filename);
try {
Files.write(path, Arrays.asList("first-line", "second-line"),
StandardCharsets.UTF_8, StandardOpenOption.CREATE);
System.out.println("writable = " + Files.isWritable(path));
path.getFileSystem().provider().checkAccess(path, AccessMode.WRITE); }
catch (Exception e) {
e.printStackTrace(); }
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
- create / update the file 'test.txt' with the two lines 'first-lin", "second-line"
- isWritable() returns true
- no exception
ACTUAL -
(on non-administrative account)
- create / update the file 'test.txt' with the two lines 'first-lin", "second-line"
- isWritable() returns false
- java.nio.file.AccessDeniedException: test.txt: Effective permissions does not allow requested access
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.nio.file.AccessDeniedException: test.txt: Effective permissions does not allow requested access'
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
see: Steps to reproduce
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
execute code / programs on account with administrative rights
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6002]
EXTRA RELEVANT SYSTEM CONFIGURATION :
non-administrative account
A DESCRIPTION OF THE PROBLEM :
Using FileSystemProvider.checkAccout (path, AccessMode.WRITE) throws an AccessDeniedException for 'path' if you work on a non-administrative account - but you can effectivly write the file denoted by 'path'.
As other code, especially Files.isWritable(path) is based on this, also this code is affected. The nice ZipFileSystem provided with Java 7 will open any zip-Files only in read-only mode, if you work with a non-administrative account.
If using an administrative account everything will be perfect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
static void testWriteAndWriteAccess() {
String filename = "test.txt";
Path path = Paths.get(filename);
try {
Files.write(path, Arrays.asList("first-line", "second-line"),
StandardCharsets.UTF_8, StandardOpenOption.CREATE);
System.out.println("writable = " + Files.isWritable(path));
path.getFileSystem().provider().checkAccess(path, AccessMode.WRITE); }
catch (Exception e) {
e.printStackTrace(); }
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
- create / update the file 'test.txt' with the two lines 'first-lin", "second-line"
- isWritable() returns true
- no exception
ACTUAL -
(on non-administrative account)
- create / update the file 'test.txt' with the two lines 'first-lin", "second-line"
- isWritable() returns false
- java.nio.file.AccessDeniedException: test.txt: Effective permissions does not allow requested access
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.nio.file.AccessDeniedException: test.txt: Effective permissions does not allow requested access'
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
see: Steps to reproduce
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
execute code / programs on account with administrative rights
- duplicates
-
JDK-7190897 (fs) Files.isWritable method returns false when the path is writable (win)
- Closed