Files.walk() is unusable because of AccessDeniedException

Alan Bateman Alan.Bateman at oracle.com
Tue May 24 20:32:15 UTC 2016


On 24/05/2016 20:52, ecki at zusammenkunft.net wrote:
> The AccessDeniedExceptions are not a java security mechanism. It is a OS mechanism and i think it is good that java reveals all information also available with native access (i.e. if you have no 'x' permission on a dir you cannot enter it but you can see it (as long asmyou have read permission on the parent).
>
> The only issue is here that the walker should be able to skip or resume walking in such a scenario. (Itmsounds like this is the problem/question here?)
>
That's right and I think this question is about the scenario where some 
of the file system is not accessible. With Files.walkFileTree then you 
provide a FileVisitor that can deal with exceptions and control which 
parts of the file tree are visited. The newer walk/find methods don't so 
it would require introducing a new API. It's come up before, and is easy 
to do, just not clear that we want to introduce yet further variations.

-Alan



More information about the core-libs-dev mailing list