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 "Yongjun Zhang (JIRA)" <ji...@apache.org> on 2016/01/05 20:39:40 UTC

[jira] [Updated] (HADOOP-12604) Exception may be swallowed in KMSClientProvider

     [ https://issues.apache.org/jira/browse/HADOOP-12604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yongjun Zhang updated HADOOP-12604:
-----------------------------------
       Resolution: Fixed
     Hadoop Flags: Reviewed
    Fix Version/s: 2.8.0
           Status: Resolved  (was: Patch Available)

Thanks [~stevel@apache.org] and [~zhz] much for the review. I committed to trunk, branch-2 and 2.8 branches.



> Exception may be swallowed in KMSClientProvider
> -----------------------------------------------
>
>                 Key: HADOOP-12604
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12604
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: kms
>            Reporter: Yongjun Zhang
>            Assignee: Yongjun Zhang
>              Labels: supportability
>             Fix For: 2.8.0
>
>         Attachments: HADOOP-12604.001.patch, HADOOP-12604.002.patch
>
>
> In KMSClientProvider# createConnection
> {code}
>       try {
>         is = conn.getInputStream();
>         ret = mapper.readValue(is, klass);
>       } catch (IOException ex) {
>         if (is != null) {
>           is.close(); <== close may throw exception
>         }
>         throw ex;
>       } finally {
>         if (is != null) {
>           is.close();
>         }
>       }
>     }
> {code}
> {{ex}} may be swallowed when {{close}} highlighted in the code throws exception.  Thanks [~qwertymaniac] for pointing this out.
> BTW, I think we should be able to consolidate the two {{is.close()}} in the above code, so we don't close the same stream twice. The one in the {{finally block}} may be called after an exception is thrown or not, and it may throw exception too, we need to be careful not to swallow exception here too.



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