hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Avgustinov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-11976) Examine code base for cases that exception is thrown from finally block and fix it
Date Thu, 15 Jun 2017 14:37:01 GMT

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

Pavel Avgustinov commented on HDFS-11976:
-----------------------------------------

This concern is easy to capture with the query language used by [lgtm|https://lgtm.com]. I've
just written a query for it, which you can see [here|https://lgtm.com/query/1995330256/project:5629499534213120/lang:java/]
-- it finds 32 results in the [GitHub mirror of Hadoop|https://github.com/apache/hadoop],
including a number within HDFS itself.

(Disclaimer: I'm a co-founder of Semmle, the company that provides lgtm as a free service
to open source.)

> Examine code base for cases that exception is thrown from finally block and fix it
> ----------------------------------------------------------------------------------
>
>                 Key: HDFS-11976
>                 URL: https://issues.apache.org/jira/browse/HDFS-11976
>             Project: Hadoop HDFS
>          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: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message