java.nio.file.Files.isReadable() slow on Windows 7
Alan.Bateman at oracle.com
Fri May 11 07:51:54 PDT 2012
On 11/05/2012 15:47, Zhong Yu wrote:
> However... test it on an unreadable file, checkAccess(path) does not
> throw an exception. Please take note of it
> The file has Read permission Deny for all users. For this file
> Files.isReadable() returns false.
> checkAccess(path, AccessMode.READ) throws
> java.nio.file.AccessDeniedException: \tmp\unreadable.txt:
> Effective permissions does not allow requested access
> AsynchronousFileChannel.open(path, READ) throws
> java.nio.file.AccessDeniedException: C:\tmp\unreadable.txt
Understood and I'll add it to the bug. The issue is that fast path is
assuming that the file is readable when it have READ_ATTRIBUTES access.
You can verify that by denying READ_ATTRIBUTES + READ.
More information about the nio-dev