lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LUCENE-5906) Use Files.delete instead of File.delete + made up exception
Date Thu, 04 Sep 2014 00:12:53 GMT

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

Robert Muir updated LUCENE-5906:
--------------------------------
    Attachment: LUCENE-5906.patch

Updated patch, with full cutover to Files.delete() (and File.delete() banned in forbidden
apis).

This forced me to review all code deleting files, and I had to plug some leaks in suggesters,
hunspell, offline sorter.

Additionally to prevent such leaks, i had to add some IOUtils methods like deleteFilesIgnoringExceptions
and so on. 

I moved TestUtil.rm to IOUtils, and fixed its exception messaging to return the actual exception
messages for each file it couldnt delete. This is now used several places in source too (that
had their own duplicate "rm" methods).

I think we should do this as a step, because deleting files is about the most dangerous thing
our code can do. So we really need real exceptions here in case something goes bad.

Later we should investigate what Uwe suggests (Path api). This would be good to look at for
lucene 5, but this patch is heavy enough.


> Use Files.delete instead of File.delete + made up exception
> -----------------------------------------------------------
>
>                 Key: LUCENE-5906
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5906
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-5906.patch, LUCENE-5906.patch
>
>
> We are on java7, if we cannot delete a file, this one returns a real exception as to
why.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message