hi team,
i have a situation,
if the inputfile is empty, the graph have to fail.
i use the UniversaldataReader to read the file. I felt no option in datareader.
So i used the javaExecute component to validate the input file. the run() metghon returns void, so i cant mark as failed.( i have to give system.exit(-1)).
other wise init() method to return false, then clover server throws componentinitialization failed exception.
Please help me to resolve this situation.
i have a situation,
if the inputfile is empty, the graph have to fail.
i use the UniversaldataReader to read the file. I felt no option in datareader.
So i used the javaExecute component to validate the input file. the run() metghon returns void, so i cant mark as failed.( i have to give system.exit(-1)).
other wise init() method to return false, then clover server throws componentinitialization failed exception.
Please help me to resolve this situation.
-
Hi,
If your validation of input file fails, you can throw runtime exception. This exception will interrupt graph processing.
Example of a class with runtime exception:import org.jetel.component.BasicJavaRunnable;
import org.jetel.exception.JetelRuntimeException;
public class MyClass extends BasicJavaRunnable {
@Override
public void run() {
// write into information log
getNode().getLog().info("Custom info message");
// Component JavaExecute will finish with status error with following message
throw new JetelRuntimeException("Input file is empty");
}
}
In console you can see:ERROR [main] -
--------------------------------- Error details ----------------------------------
Component [JavaExecute:JAVA_EXECUTE] finished with status ERROR.
Input file is empty
----------------------------------------------------------------------------------
ERROR [main] - Execution of graph failed ! -
Thanks
Please sign in to leave a comment.
Comments 2