hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-11101) How about inputstream close statement from catch block to finally block in FileContext#copy() ?
Date Thu, 25 Sep 2014 11:35:39 GMT

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

Hudson commented on HADOOP-11101:
---------------------------------

FAILURE: Integrated in Hadoop-Yarn-trunk #691 (See [https://builds.apache.org/job/Hadoop-Yarn-trunk/691/])
HADOOP-11101. How about inputstream close statement from catch block to finally block in FileContext#copy()
( Contributed by skrho ) (vinayakumarb: rev dff95f7af899a4f2add791afbd20c8a1e33c7a36)
* hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java
* hadoop-common-project/hadoop-common/CHANGES.txt


> How about inputstream close statement from catch block to finally block in FileContext#copy()
?
> -----------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-11101
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11101
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 2.5.1
>            Reporter: skrho
>            Priority: Minor
>             Fix For: 2.6.0
>
>         Attachments: HADOOP-11101_001.patch, HADOOP-11101_002.patch, HADOOP-11101_003.patch
>
>
> If IOException is happended, can be catched exception block.. 
> But another excpetion is happended, can't be catched exception block.. also Stream object
can't be closed..
> {code}
>         try {
>           in = open(qSrc);
>           EnumSet<CreateFlag> createFlag = overwrite ? EnumSet.of(
>               CreateFlag.CREATE, CreateFlag.OVERWRITE) : 
>                 EnumSet.of(CreateFlag.CREATE);
>           out = create(qDst, createFlag);
>           IOUtils.copyBytes(in, out, conf, true);
>         } catch (IOException e) {
>           IOUtils.closeStream(out);
>           IOUtils.closeStream(in);
>           throw e;
>         }
> {code}



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

Mime
View raw message