Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Null pointer exception - tMap

Hi everyone,
I am facing this error (c.f screenshot) for a while now. Usually Google is my friend, but not today.
Thank you for your advice,
0683p000009MCGM.png 0683p000009MCGR.png 0683p000009MCBE.png
EDIT :
I think the error comes from the absence of a null test. Therefore I tried this 3 kind of test but none works.

(String)row7.selling_price.equals(null))?0:row7.selling_price

(row7.selling_price.toString().equals(null))?0:row7.selling_price

(row7.selling_price == null)?0:row7.selling_price
Labels (2)
26 Replies
Anonymous
Not applicable
Author

Thx for the information rhall_2.0.
In the MySQL DB,  payment_date has the type DATE and the values look like "2015-11-13".
So far, I can't find a better solution than this one:
((String.valueOf(row8.payment_date).equals("null"))
||
(String.valueOf(row8.payment_date).equals("NULL"))
||
(String.valueOf(row8.payment_date).isEmpty()))
?false
:true 
Anonymous
Not applicable
Author

OK, I think I understand what is wrong. If payment_date is definitely a Date the below code will work....
row8.payment_date==null ? false:true

 The Expression tester is useless and I am guessing you are basing your tests on that. I just put together the below test job to prove this....

0683p000009MCDZ.pngThe tFixedFlowInpt config is below....

0683p000009MAQt.png
The tMap config is below....

0683p000009MCBJ.png
The Expression with the test result is below.....

0683p000009MCGg.png
What is actually produced by the tLogRow is below....

0683p000009MCGl.png
Basically, the Test functionality is flawed and you should try and test things by printing out to the console. It shouldn't be this way, but it is just one of those things you learn when using Talend.
Anonymous
Not applicable
Author

Thank you a lot rhall_2.0!
I loose so much time on that 0683p000009MACn.png
Indeed, it is just a bug at the test level.
Thanks to everyone.
Anonymous
Not applicable
Author

I know this may be not related to this but I working on 2 sheet of same excel file and trying to inserting one column each from both sheets to a table(single) by joining 2 sheets but I'm getting 0 rows on this inspite of having some data matches based on key.Later I found out that it is due to Talend trying to extract data from sheets as column1 --> column1 specified in schema but due to initial column is empty bydefault form source which not have any column name and that why on doing join based on key giving different column value from sheet as talend is assuming 1 blank column in sheet as schema first column data.

eg; row1 is 

|    |id|name|

|    |123|"Joe"|

|    |124| "Jack"|

So on asking row1.id for join it inspite of taking 123 taking NULL(first column of 1st record) and on taking row1.name giving 123 instead of "Joe" .

Not related but will help someone in future.

Vijay_K_N
Contributor
Contributor

How to find null pointer exception if we have 500 columns ????
talendtester
Creator III
Creator III

This solved the issue for my data set, if it helps others:

 

###STRING TO DATE - null:

( row3.myDate.equals("")

|| row3.myDate.isEmpty()

|| row3.myDate.equals("null")

|| row3.myDate.equals("NULL")

|| row3.myDate.equals("''")

|| row3.myDate==null

?null:TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM-dd",TalendDate.parseDate("MM/dd/yyyy",row3.myDate) )

))

Just_learner
Contributor
Contributor

Thanks it worked for me.