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

Uwe Schindler resolved LUCENE-5550.
-----------------------------------

    Resolution: Fixed
      Assignee: Uwe Schindler

> Handle NoSuchFileException
> --------------------------
>
>                 Key: LUCENE-5550
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5550
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Uwe Schindler
>            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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to