Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
row21.surplus_factor != null ? row21.surplus_factor.doubleValue() : 0
The main reason for NullPointerException in the tMap is the so called Unboxing of primitive data type wrapper objects.
This means: your read a column which is nullable and write into a column which is not nullable. Especially for numeric data types this leads to this problem.
Lets assume you read an "Integer" (refer to the schema column and check if nullable) and write into a "int" (not nullable).
If you map this the compiler generates this code: row1.my_integer.intValue()
If row1.my_integer is null -> Bang we have the mentioned NullPointerException.
Unfortunately you can only find the causing column if you take a look into the source code (refer to the stack trace of the exception).
To avoid that write this a expression in the output flow:
row1.my_integer != null ? row1.my_integer : 0
This checks the null state and if it is null, it sends a zero to the output flow.