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

Steve Loughran updated HADOOP-16297:
------------------------------------
    Issue Type: Sub-task  (was: Bug)
        Parent: HADOOP-16300

> MiniKdc.main() throws a RuntimeException when the work directory does not 
> exist
> -------------------------------------------------------------------------------
>
>                 Key: HADOOP-16297
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16297
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: eBugs
>            Priority: Minor
>
> Dear Hadoop 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-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java
> Line: 86
> {code:java}
> if (!workDir.exists()) {
>   throw new RuntimeException("Specified work directory does not exists: "
>           + workDir.getAbsolutePath());
> }{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 the {{workDir}} does not exist. This mismatch could be 
> a problem. For example, the callers may miss the "directory does not exist" 
> scenario because an inaccurate exception is thrown. Or, the callers trying to 
> handle other {{RuntimeException}} may accidentally (and incorrectly) handle 
> the "directory does not exist" scenario. Throwing a {{FileNotFoundException}} 
> may be more accurate here.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to