On 08/11/2018 12:59, Jaikiran Pai wrote:
A slightly related question - I used the example that Roger showed and
it mostly worked. However, Files.isSameFile throws a
java.nio.file.NoSuchFileException since the path2 doesn't exist (on a
case sensitive file system). I checked the javadoc of Files.isSameFile
and couldn't find a clear mention if this is expected. It does talk
about the existence checks that might be carried out in this
implementation, but doesn't mention that it will throw an exception in
the absence of either of the passed paths. Is this expected? Or should
the implementation internally catch this exception and return false?

IOException is correct, the methods in this API aren't specify all the possible sub-classes. In a few places you will see specific exceptions specified as "optional specific exception" where it make sense. We could potentially improve the spec for the cannot access or does not exist cases but hasn't been an issue to date.

-Alan

Reply via email to