You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "skrho (JIRA)" <ji...@apache.org> on 2014/09/17 12:49:33 UTC

[jira] [Created] (HADOOP-11101) How about inputstream close statement from catch block to finally block in FileContext#copy() ?

skrho created HADOOP-11101:
------------------------------

             Summary: 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
            Reporter: skrho
            Priority: Minor


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..


        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;
        }



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