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

stack commented on HBASE-22369:
-------------------------------

Looking at it, it's fatal if CP can't create dir and we don't want the process 
to start up; hence the RE.

> CoprocessorClassLoader.init() throws a RuntimeException when it fails to 
> create a directory
> -------------------------------------------------------------------------------------------
>
>                 Key: HBASE-22369
>                 URL: https://issues.apache.org/jira/browse/HBASE-22369
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.1.4
>            Reporter: eBugs
>            Priority: Minor
>
> Dear HBase 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 seem to indicate different error 
> conditions.
>  
> Version: HBase-2.1.4 
> File: 
> HBASE-ROOT/hbase-common/src/java/org/apache/hbase/utils/CoprocessorClassLoader.java
> Line: 160-161
> {code:java}
> throw new RuntimeException("Failed to create local dir " + parentDirStr
>   + ", CoprocessorClassLoader failed to init");{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 {{init()}} failed to create a directory. This mismatch 
> could be a problem. For example, the callers may miss the case where 
> {{init()}} fails to create a directory. Or, the callers trying to handle 
> other {{RuntimeException}} may accidentally (and incorrectly) handle the 
> directory creation failure.



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

Reply via email to