You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "hamada (JIRA)" <ji...@apache.org> on 2018/01/29 20:43:00 UTC

[jira] [Comment Edited] (SOLR-11892) Avoid unnecessary exceptions in FSDirectory and RAMDirectory

    [ https://issues.apache.org/jira/browse/SOLR-11892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16343976#comment-16343976 ] 

hamada edited comment on SOLR-11892 at 1/29/18 8:42 PM:
--------------------------------------------------------

specifically the code of interest where an IOException is thrown  RAMDirectory :

@Override
 public void deleteFile(String name) throws IOException {
 ensureOpen();
 RAMFile file = fileMap.remove(name);
 if (file != null)

{ file.directory = null; sizeInBytes.addAndGet(-file.sizeInBytes); }

else

{ // FIXME there are no file operations here this method removes fileName entry from a map, it isn't per se deleting a file!

throw new FileNotFoundException(name); }

}


was (Author: hamadaca):
specifically the code of interest where an IOException is thrown :

@Override
public void deleteFile(String name) throws IOException {
 ensureOpen();
 RAMFile file = fileMap.remove(name);
 if (file != null) {
 file.directory = null;
 sizeInBytes.addAndGet(-file.sizeInBytes);
 } else {

// FIXME there are no file operations here this method removes fileName entry from a map, it isn't per se removing deleting a file!
 throw new FileNotFoundException(name);
 }
}

> Avoid unnecessary exceptions in FSDirectory and RAMDirectory
> ------------------------------------------------------------
>
>                 Key: SOLR-11892
>                 URL: https://issues.apache.org/jira/browse/SOLR-11892
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>            Priority: Minor
>         Attachments: Screen Shot 2018-01-24 at 9.09.55 PM.png, Screen Shot 2018-01-24 at 9.10.47 PM.png
>
>
> In privateDeleteFile, just use deleteIfExists.
> in RamDirectory we can declare a static exception and create it once.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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