java.lang.NullPointerException Error

Seven Stars RAJ
Seven 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

Thanks
RAJ

Accepted Solutions
Thirteen 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

-----------

All Replies
Thirteen 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

-----------
Seven Stars RAJ
Seven Stars

Re: java.lang.NullPointerException Error

Thank you @vapukov

Thanks
RAJ
One Star

Re: java.lang.NullPointerException Error

Hello,

I am experiencing a similar issue when using the sql editor. Do you mind giving more specific details on what you mean by "other variant - define default value for replace null"?

Thanks so much!