You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "eBugs (JIRA)" <ji...@apache.org> on 2019/05/06 16:06:00 UTC

[jira] [Created] (HDFS-14474) PeerCache.close() throws a RuntimeException when it is interrupted

eBugs created HDFS-14474:
----------------------------

             Summary: PeerCache.close() throws a RuntimeException when it is interrupted
                 Key: HDFS-14474
                 URL: https://issues.apache.org/jira/browse/HDFS-14474
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: eBugs


Dear HDFS developers, we are developing a tool to detect exception-related bugs in Java. Our prototype has spotted the following {{throw}} statement whose exception class and error message indicate different error conditions.

 

Version: Hadoop-3.1.2

File: HADOOP-ROOT/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/PeerCache.java

Line: 283
{code:java}
throw new RuntimeException("failed to join thread");{code}
 

{{RuntimeException}} is usually used to represent errors in the program logic (think of one of its subclasses, {{NullPointerException}}), while the error message indicates that {{close()}} is interrupted. This mismatch could be a problem. For example, the callers may miss the interrupt. Or, the callers trying to handle other {{RuntimeException}} may accidentally (and incorrectly) handle interrupt. If throwing checked exceptions is not preferred, wrapping the {{InterruptedException}} is better here.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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