Path.checkAccess (6873681)
Alan Bateman
Alan.Bateman at oracle.com
Thu Oct 14 03:45:44 PDT 2010
Mark Thornton wrote:
> In my experience the main reason for using check methods has been
> because you couldn't programmatically determine the reason for failure
> from the IOException (or some methods didn't throw an exception at all
> --- File.delete). Given a useful exception heirarchy I would far
> prefer to try the operation first and then handle the exception if one
> arises.
A while back I attempted to find out where the typical usages of canXXX
were and in many cases, it was because the file operations lacked useful
exceptions. As we've addressed that one, then the need for most of these
usages should go away (as intended). That should make the application
more secure and also improve performance as each of those canXXX methods
required checking the file.
Other usages included GUI apps where the result of canXXX influence how
the file was displayed (in grey if the file is read-only for example).
Using the existing checkAccess for this type of usage is a bit awkward,
but it does suggest there are usages where we still require some support.
-Alan
More information about the nio-dev
mailing list