Customer Portal

How to make the JavaExecute component to fail

Comments 2

  • Avatar
    novakj
    0
    Comment actions Permalink
    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 !
  • Avatar
    evijayan2
    0
    Comment actions Permalink
    Thanks

Please sign in to leave a comment.