Most jobs at some point require validation and will often need to be stopped if the data is found to be in error. In most cases, you can use tDie
, however, if your error is found in a tJavaRow
or tJava,
then using tDie
becomes quite convoluted. This exercise shows how the same results can be achieved using simple Java functionality.
The steps for killing a job from within tJavaRow are as follows:
Run the job. You will see that it fails with a null pointer exception.
Change the line
output_row.age = input_row.age;
to the following code:if (input.age == null) { System.out.println("Fatal Error: age is null"); System.exit(99); } else { output_row.age = input_row.age; }
Run the job again. You will see that the job has been killed in a much more elegant fashion, as shown in the following screenshot: