A DESCRIPTION OF THE PROBLEM :
The documentation for Files.exists does not mention, except obliquely, that it eats IOException. By contrast, the Files.isDirectory method says "Where it is required to distinguish an I/O exception from the case that the file is not a directory then the file attributes can be read with..."
(I say "obliquely" because the docs do say "... the file does not exist or its existence cannot be determined." -- this, in my view, requires some reading between the lines).
Incidentally, I think that entire family of IOException-eating functions should be deprecated. Eating FileNotFoundException (ENOENT or ENOTDIR), is reasonable for these functions. Eating EIO is basically never what you want. So as well as clarifying the javadoc, it would be OK with me to replace the entire range of functions with safe replacements.
The documentation may be clarified by adding a link to FileSystemProvider.checkAccess() which explains the exceptions which it can throw.
The documentation for Files.exists does not mention, except obliquely, that it eats IOException. By contrast, the Files.isDirectory method says "Where it is required to distinguish an I/O exception from the case that the file is not a directory then the file attributes can be read with..."
(I say "obliquely" because the docs do say "... the file does not exist or its existence cannot be determined." -- this, in my view, requires some reading between the lines).
Incidentally, I think that entire family of IOException-eating functions should be deprecated. Eating FileNotFoundException (ENOENT or ENOTDIR), is reasonable for these functions. Eating EIO is basically never what you want. So as well as clarifying the javadoc, it would be OK with me to replace the entire range of functions with safe replacements.
The documentation may be clarified by adding a link to FileSystemProvider.checkAccess() which explains the exceptions which it can throw.