Request for review: 7190897 (fs) Files.isWritable method returns false when the path is writable (win).

Alexey Utkin alexey.utkin at
Thu Feb 28 15:17:20 UTC 2013

On 28.02.2013 18:31, Alan Bateman wrote:
> On 28/02/2013 11:54, Alexey Utkin wrote:
>> :
>> The suggested fix:
> Thanks for sorting this out, this code should have used AccessCheck in 
> the original implementation. A couple of comments:
> Did you consider having AccessCheckForFile take a parameter for the 
> mapping so that it wouldn't be file-specific (and so could be renamed 
> to AccessCheck)?
That is not single, but 4 additional parameters ( FILE_GENERIC_READ, 
relatively complicate masks. That parameters have to be changed 
consistently to avoid the problem (there is the analogy with orthogonal 
basis in geometry If you understand what I mean). Now we use the 
[AccessCheckForFile] just in [nio] package. We can extend the 
implementation any time we need it.
> checkFileAccess ignores the exception from AccessCheck whereas I 
> should it should be translated to an IOException.
That is by design. Any problem with the [checkFileAccess] need to be 
converted to the [false] return value. At the end point - in the
[WindowsFileSystemProvider.checkAccess] function - the [false] return 
value would be converted to the [AccessDeniedException] exception - that 
is desired code flow.
> Otherwise I think this is good. You don't have a test case but I can't 
> think how this could be tested anyway as we already have tests for 
> checkAccess and isWritable.
I have the test. It is attached to the bug as Netbeans project, but it 
need manual security setup in security tab of the [demofile.txt] file 
(as shown in attached screenshot). By changing the "Write" check box on 
the [demofile.txt] file security dialog, test result have varying 
Seems the web bug-db interface is not synchronized yet.
> -Alan.

More information about the core-libs-dev mailing list