You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Francesco Mari (JIRA)" <ji...@apache.org> on 2017/12/05 16:33:00 UTC

[jira] [Commented] (OAK-7031) DeleteOnCloseFileInputStream should properly handle errors when deleting the file

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

Francesco Mari commented on OAK-7031:
-------------------------------------

I hopefully fixed the problem at r1817214. Should the test fail for the same reason, I have to assume that the bug is somewhere else in the JVM or in the file system. The code now looks like this.

{noformat}
super.close();

if (Files.deleteIfExists(file.toPath())) {
    log.debug("File {} was deleted", file.getAbsolutePath());
} else {
    log.debug("Could not delete {}, not found", file.getAbsoluteFile());
}
{noformat}

This shouldn't fail. If it does, it is because {{close()}} is not propagating a I/O error, and that's nothing we can fix, I guess.

> DeleteOnCloseFileInputStream should properly handle errors when deleting the file
> ---------------------------------------------------------------------------------
>
>                 Key: OAK-7031
>                 URL: https://issues.apache.org/jira/browse/OAK-7031
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Francesco Mari
>            Assignee: Francesco Mari
>             Fix For: 1.8, 1.7.13
>
>
> {{DeleteOnCloseFileInputStream}} uses {{File#delete}} to delete the temporary file. It would be an improvement to use {{Files#deleteIfExists}}, which would provided more detailed reports in case of errors.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)