[
https://issues.apache.org/jira/browse/LUCENE-5550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Uwe Schindler updated LUCENE-5550:
----------------------------------
Attachment: LUCENE-5550.patch
Fixed patch. The problem with delegate vs. in was a change by [~jpountz] in a
later commit.
I wil now compare trunks vs. branch about occurences of this Java 7 exception
again and commit after running tests
> Handle NoSuchFileException
> --------------------------
>
> Key: LUCENE-5550
> URL: https://issues.apache.org/jira/browse/LUCENE-5550
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Michael McCandless
> Priority: Blocker
> Fix For: 4.8
>
> Attachments: LUCENE-5550.patch, LUCENE-5550.patch
>
>
> With Java 7 we now must handle either NoSuchFileException (thrown by nio) or
> FileNotFoundException (thrown by pre-nio io apis) coming out of some
> Directory methods.
> We did this on trunk already but we need to do it for 4.x as well...
> including fixing MockDirWrapper to randomly pick one to throw.
> Uwe said:
> I did a grep for NoSuchFileException on trunk and 4.x.
> In trunk we have many more of this Excepotion, especially also randomization
> in MockDirectory to throw this one or FNFE. We should backport those fixes:
> Branch_4x:
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * (not
> {@code java.nio.file.NoSuchFileException} of Java 7).
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * (not
> {@code java.nio.file.NoSuchFileException} of Java 7).
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * (not
> {@code java.nio.file.NoSuchFileException} of Java 7).
> ./lucene/replicator/src/test/org/apache/lucene/replicator/LocalReplicatorTest.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/replicator/src/test/org/apache/lucene/replicator/LocalReplicatorTest.java:
> } catch (FileNotFoundException | NoSuchFileException e) {
> Trunk:
> ./lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java: }
> catch (FileNotFoundException | NoSuchFileException fnfe) {
> ./lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java:
> } catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * <li>Throws
> {@link FileNotFoundException} or {@link NoSuchFileException}
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * <p>Throws
> {@link FileNotFoundException} or {@link NoSuchFileException}
> ./lucene/core/src/java/org/apache/lucene/store/Directory.java: * <p>Throws
> {@link FileNotFoundException} or {@link NoSuchFileException}
> ./lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java: }
> else if (t instanceof FileNotFoundException || t instanceof
> NoSuchFileException) {
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java:
> fail("opening DirectoryReader on empty directory failed to produce
> FileNotFoundException/NoSuchFileException");
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java: }
> catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java:
> fail("expected FileNotFoundException/NoSuchFileException");
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java: }
> catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java:
> fail("expected FileNotFoundException/NoSuchFileException");
> ./lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java: }
> catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java:
> } catch (FileNotFoundException | NoSuchFileException ex) {
> ./lucene/core/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java:
> } catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/core/src/test/org/apache/lucene/index/TestIndexWriterLockRelease.java:
> } catch (FileNotFoundException | NoSuchFileException e1) {
> ./lucene/core/src/test/org/apache/lucene/store/TestDirectory.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/core/src/test/org/apache/lucene/store/TestDirectory.java:
> } catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/replicator/src/test/org/apache/lucene/replicator/LocalReplicatorTest.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/replicator/src/test/org/apache/lucene/replicator/LocalReplicatorTest.java:
> } catch (FileNotFoundException | NoSuchFileException e) {
> ./lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java:import
> java.nio.file.NoSuchFileException;
> ./lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java:
> throw randomState.nextBoolean() ? new FileNotFoundException("a random
> IOException (" + name + ")") : new NoSuchFileException("a random IOException
> (" + name + ")");
> ./lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java:
> throw randomState.nextBoolean() ? new FileNotFoundException(name + " in
> dir=" + in) : new NoSuchFileException(name + " in dir=" + in);
> ./lucene/test-framework/src/java/org/apache/lucene/store/MockDirectoryWrapper.java:
> throw randomState.nextBoolean() ? new FileNotFoundException(name) : new
> NoSuchFileException(name);
> This is important to fix before we release 4.8 for Java 7
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]