On 28.02.2013 18:31, Alan Bateman wrote:
On 28/02/2013 11:54, Alexey Utkin wrote:
:

The suggested fix:
http://cr.openjdk.java.net/~uta/openjdk-webrevs/JDK-7190897/webrev.00/
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, FILE_GENERIC_WRITE, FILE_GENERIC_EXECUTE, FILE_ALL_ACCESS) - that are 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 accordingly.
Seems the web bug-db interface is not synchronized yet.
-Alan.

Reply via email to