# How to make the JavaExecute component to fail

**URL:** <https://forum.cloverdx.com/t/how-to-make-the-javaexecute-component-to-fail/1363>\
**Category:** CloverDX Platform\
**Created:** [March 7, 2014, 12:00am UTC](https://forum.cloverdx.com/t/how-to-make-the-javaexecute-component-to-fail/1363 "2014-03-07T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![evijayan2](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/evijayan2/32/125_2.png) [@evijayan2](https://forum.cloverdx.com/u/evijayan2)\
**Post date:** [March 7, 2014, 12:00am UTC](https://forum.cloverdx.com/t/how-to-make-the-javaexecute-component-to-fail/1363/1 "2014-03-07T00:00:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![novakj](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@novakj](https://forum.cloverdx.com/u/novakj)\
**Post date:** [March 10, 2014, 11:53am UTC](https://forum.cloverdx.com/t/how-to-make-the-javaexecute-component-to-fail/1363/2 "2014-03-10T11:53:19Z")

</div>

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:

```auto
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:

```auto
ERROR [main] - 
--------------------------------- Error details ----------------------------------
  Component [JavaExecute:JAVA_EXECUTE] finished with status ERROR.
   Input file is empty
----------------------------------------------------------------------------------
ERROR [main] - Execution of graph failed !

```

---

<div class="post-metadata">

**Author:** ![evijayan2](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.cloverdx.com/evijayan2/32/125_2.png) [@evijayan2](https://forum.cloverdx.com/u/evijayan2)\
**Post date:** [May 7, 2014, 8:42pm UTC](https://forum.cloverdx.com/t/how-to-make-the-javaexecute-component-to-fail/1363/3 "2014-05-07T20:42:55Z")

</div>

Thanks
