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 2017/06/15 00:06:00 UTC

[jira] [Updated] (HADOOP-14526) Examine code base for cases that exception is thrown from finally block

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

Yongjun Zhang updated HADOOP-14526:
-----------------------------------
    Description: 
If exception X is thrown in try block, and exception Y is thrown is finally block, X will be swallowed. 

In addition, finally block is used to ensure resources are released properly in general. If we throw exception from there, some resources may be leaked. So it's not recommended to throw exception in the finally block

I caught one today and reported HDFS-11794, creating this jira as a master one to catch other similar cases.

Hope there is some static analyzer to find all.


  was:
If exception X is thrown in try block, and exception Y is thrown is finally block, X will be swallowed. 

In addition, finally block is used to ensure resources are released properly in general. If we throw exception from there, some resources may be leaked. So it's not recommended to throw exception in the finally block

I caught one today and reported HDFS-11794, creating this jira as a master one to catch other similar cases.




> Examine code base for cases that exception is thrown from finally block
> -----------------------------------------------------------------------
>
>                 Key: HADOOP-14526
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14526
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Yongjun Zhang
>
> If exception X is thrown in try block, and exception Y is thrown is finally block, X will be swallowed. 
> In addition, finally block is used to ensure resources are released properly in general. If we throw exception from there, some resources may be leaked. So it's not recommended to throw exception in the finally block
> I caught one today and reported HDFS-11794, creating this jira as a master one to catch other similar cases.
> Hope there is some static analyzer to find all.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org