我们有Talend数据集成工具,它在将信息从源系统发送到目标系统时使用eclipse代码。 得到错误
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]
输入:
日期数据类型是tmap组件中空值的来源
DNDB date type(source) ---->row1.DNDB(output) is Date data type. both are nullable.
我们尝试过: 但是对我们没用。
避免null row1.DNDB == null?" null":row1.DNDB
答案 0 :(得分:1)
row1.DNDB==null?"null":row1.DNDB
不起作用:您将输出值分配为“null”(带双引号的字符串)或row1.DNDB,它应该是日期。编译时会有一个强制转换异常。
你可以尝试:
Relational.ISNULL(row1.DNDB)?null:row1.DNDB
如果你想要一个Date返回类型; 或
Relational.ISNULL(row1.DNDB)?"null":TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",row1.DNDB)
如果你想要两个值的String返回类型。
同时检查输出列是否已标记为可为空(复选框)