eBugs created YARN-9532:
---------------------------
Summary: SLSRunner.run() throws a YarnException when it fails to
create the output directory
Key: YARN-9532
URL: https://issues.apache.org/jira/browse/YARN-9532
Project: Hadoop YARN
Issue Type: Bug
Reporter: eBugs
Dear YARN 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-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java
Line: 894
{code:java}
if (!outputFile.exists() && !outputFile.mkdirs()) {
System.err.println("ERROR: Cannot create output directory "
+ outputFile.getAbsolutePath());
throw new YarnException("Cannot create output directory");
}{code}
The exception is triggered when {{run()}} fails to create the output directory
(as indicated by the {{if}} condition and the error message). However, throwing
a {{YarnException}} is too general and makes accurate exception handling more
difficult. Since the error is related to I/O, throwing an {{IOException}}, or
wrapping an {{IOException}} could be better.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]