hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Nauroth (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-11392) Use IOUtils.closeStream while closing streams in FileUtil.java
Date Thu, 26 Feb 2015 22:44:06 GMT

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

Chris Nauroth commented on HADOOP-11392:
----------------------------------------

This patch changes {{FileUtil#copyMerge}}.  As it turns out, this method is currently unused
in the Hadoop source tree.  In branch-1, it had been part of the implementation of the {{hadoop
fs -getmerge}} shell command.  In branch-2, the code for that shell command was rewritten
in a way that no longer requires this method.

Since the method is annotated {{Public}}, I scanned other ecosystem projects for references
to it.  The only caller I could find was in Mahout.

Instead of maintaining this code, I'd like to suggest that we resolve this as won't fix. 
We can file a separate jira to propose deprecation of the method, followed by eventual removal
after politely asking Mahout to migrate off of it.  The class is annotated {{Evolving}}, so
we have the right to make a breaking change at a minor version boundary.

Thoughts?

> Use IOUtils.closeStream while closing streams in FileUtil.java
> --------------------------------------------------------------
>
>                 Key: HADOOP-11392
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11392
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>         Attachments: HADOOP-11392-1.patch, HADOOP-11392.patch
>
>
>  Please check following code for same..
> {code}
> try {
>         in = srcFS.open(src);
>         out = dstFS.create(dst, overwrite);
>         IOUtils.copyBytes(in, out, conf, true);
>       } catch (IOException e) {
>         IOUtils.closeStream(out);
>         IOUtils.closeStream(in);
>         throw e;
>       }
>     }
> {code}
>  *can we use IOUtils.closeStream while closing the streams*  
> {code}
>   IOUtils.copyBytes(in, out, conf, false);
>             if (addString!=null)
>               out.write(addString.getBytes("UTF-8"));
>                 
>           } finally {
>             in.close();
>           } 
>         }
>       }
>     } finally {
>       out.close();
>     }
> {code}



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

Mime
View raw message