Six Stars

java.lang.NullPointerException Error

Hi Talend folks,

             

               When I write below expression for particular column. I am Facing "NullPointerException".

How to solve this issues. please tell me?

 

(row8.Sales.equals("o") && row9.Bun.equals("B"))?
"B" : (row8.Sales).equals("o")?
"D" : (row8.Sales.equals("o") && row9.Bun.equals("B"))?
"B": row8.Sales

 

Screenshot (986).png

 

ERROR:

Exception in component tMap_3 (LM)
java.lang.NullPointerException
at local_project___java.lm_0_1.LM.tFileInputExcel_2Process(LM.java:19165)
at local_project___java.lm_0_1.LM.runJobInTOS(LM.java:21300)
at local_project___java.lm_0_1.LM.main(LM.java:21126)
[FATAL]: local_project___java.lm_0_1.LM - tMap_3 null

1 ACCEPTED SOLUTION

Accepted Solutions
Ten Stars

Re: java.lang.NullPointerException Error

add check null

 

(row8.Sales!=null&&row9.Bun!=null)&&(row8.Sales.equals("o") && row9.Bun.equals("B"))?

You need add check null for all important columns

 

for example - first check - if any of columns null - than null
other variant - define default value for replace null

-----------
2 REPLIES
Ten Stars

Re: java.lang.NullPointerException Error

add check null

 

(row8.Sales!=null&&row9.Bun!=null)&&(row8.Sales.equals("o") && row9.Bun.equals("B"))?

You need add check null for all important columns

 

for example - first check - if any of columns null - than null
other variant - define default value for replace null

-----------
Six Stars

Re: java.lang.NullPointerException Error

Thank you @vapukov