hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6902) FileWriter should be closed in finally block in BlockReceiver#receiveBlock()
Date Mon, 25 Aug 2014 22:48:58 GMT

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

Colin Patrick McCabe commented on HDFS-6902:
--------------------------------------------

Please use {{IOUtils#cleanup}} so that we don't get bitten if close itself throws an exception.

+1 after that is addressed

> FileWriter should be closed in finally block in BlockReceiver#receiveBlock()
> ----------------------------------------------------------------------------
>
>                 Key: HDFS-6902
>                 URL: https://issues.apache.org/jira/browse/HDFS-6902
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Tsuyoshi OZAWA
>            Priority: Minor
>         Attachments: HDFS-6902.1.patch
>
>
> Here is code starting from line 828:
> {code}
>             try {
>               FileWriter out = new FileWriter(restartMeta);
>               // write out the current time.
>               out.write(Long.toString(Time.now() + restartBudget));
>               out.flush();
>               out.close();
>             } catch (IOException ioe) {
> {code}
> If write() or flush() call throws IOException, out wouldn't be closed.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message