Uwe Schindler created LUCENE-5047:
-------------------------------------

             Summary: 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: 5.0


In trunk, we use FileChannel.open() when opening files from NIOFsDir and 
MMapDirectory. These methods (all new APIs in Java 7) throw 
java.nio.file.NoSuchFileException if an File does not exist. The old-style 
FileNotFoundException is only thrown by old APIs.

We have to decide how to creectly document the expected behaviour in the 
abstract Directory interface and how we fix this.

The new Exceptions are more specific, so you get the "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 posisble 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to