We have Talend Data Integration tool which uses eclipse code while sending the info from source to target system. Getting error
Exception in component tMap_1
java.lang.NullPointerException
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.tJDBCInput_2Process(Copy_of_ReadSysproAndSendMail.java:1937)
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.runJobInTOS(Copy_of_ReadSysproAndSendMail.java:5086)
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.main(Copy_of_ReadSysproAndSendMail.java:4885)
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.tJDBCInput_2Process(Copy_of_ReadSysproAndSendMail.java:2098)
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.runJobInTOS(Copy_of_ReadSysproAndSendMail.java:5355)
at bigdata.copy_of_readsysproandsendmail_0_1.Copy_of_ReadSysproAndSendMail.main(Copy_of_ReadSysproAndSendMail.java:5154)
Job Copy_of_ReadSysproAndSendMail ended at 23:16 03/10/2016. [exit code=0]
Input :
Date data type is source of null values in tmap component
DNDB date type(source) ---->row1.DNDB(output) is Date data type. both are nullable.
We tried : But did not work for us.
To avoid null
row1.DNDB==null?"null":row1.DNDB
row1.DNDB==null?"null":row1.DNDB
can't work : you are assigning to the output value either "null" (a string, with the double quotes) or row1.DNDB , which should be a date. You will have a cast exception in compilation.
You can try either :
Relational.ISNULL(row1.DNDB)?null:row1.DNDB
if you want a Date return type ; or
Relational.ISNULL(row1.DNDB)?"null":TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",row1.DNDB)
if you want a String return type for both values.
Also check that your output column is marked as nullable (checkbox)