You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/03/22 12:03:42 UTC

[jira] [Updated] (LUCENE-5047) Trunk's NIOFSDir and MMapDir throw different Exception on file not found cases because of use of FileChannel.open()

     [ https://issues.apache.org/jira/browse/LUCENE-5047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-5047:
----------------------------------

    Fix Version/s: 4.8

> Trunk's NIOFSDir and MMapDir throw different Exception on file not found cases because of use of FileChannel.open()
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-5047
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5047
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/store
>    Affects Versions: 5.0
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.8, 5.0
>
>         Attachments: LUCENE-5047.patch, LUCENE-5047.patch, LUCENE-5047.patch
>
>
> In trunk, we use FileChannel.open() when opening files from NIOFSDir and MMapDirectory. This new method (all new APIs in Java 7!) throw java.nio.file.NoSuchFileException if a file does not exist. The old-style FileNotFoundException is only thrown by old APIs.
> We have to decide how to correctly document the expected behaviour in the abstract Directory interface and how we fix this (Directory should clearly state *which* IOException type is to be thrown if we really depend on the specific type).
> The new exceptions are more specific, so you get the most "correct" exception (it may happen with old apis that you get FNFE if you open a file where you have no access because it is locked...). With Java 7's FileChannel.open() you get a separate and correct Exception.
> A possible fix for now may be to try/catch for the new Exceptions in the 2 directory impls (there is also a try-with-resources there) and rethrow as FNFE.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org