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 indicate different error
conditions. Since we are not very familiar with HBase's internal work flow,
could you please help us verify if this is a bug, i.e., will the callers
have trouble handling the exception, and will the users/admins have
trouble diagnosing the failure?
Version: HBase-2.1.4
File:
HBASE-ROOT/hbase-common/src/java/org/apache/hbase/utils/DynamicClassLoader.java
Line: 109-112
if (!localDir.mkdirs() && !localDir.isDirectory()) {
throw new RuntimeException("Failed to create local dir " + localDir.getPath()
+ ", DynamicClassLoader failed to init");
}
RuntimeException is usually used to represent errors in the program logic
(think of one of its subclasses, NullPointerException), while the error
message indicates that initTempDir() failed to create a directory. Will
this mismatch be a problem? For example, will the callers miss the case
where initTempDir() fails to create a directory? Or, will the callers try
to handle other RuntimeException accidentally (and incorrectly) handle the
directory creation failure?
Thanks!