Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sbarjatya
Contributor
Contributor

Null Pointer Exception in tmap

I am getting Null pointer exception error in tmap even after handling all the null values in expression below [row2.len1Pd is 'String' and row2.len1 is 'Short']:

(!Relational.ISNULL(row2.len1Pd)||row2.len1Pd !=null||!row2.len1Pd.equals("")) && row2.len1 !=null ?
(row2.len1Pd.equals("LF")?(row2.len1*365.25*80):
(row2.len1Pd.equals("YR")?(row2.len1*365.25):
((row2.len1Pd.equals("MO")||row2.len1Pd.equals("MN"))?(row2.len1*(365.25/12)):
(row2.len1Pd.equals("WK")?(row2.len1*7):
(row2.len1Pd.equals("HR")?(row2.len1/24):
(row2.len1Pd.equals("DA")?(row2.len1):null))))))
:null

 

I am not sure, what am I missing. Any advice would be appreciated.

Thanks in advance. 

Labels (2)
1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

I am sure that null pointer exception will give when you have not handled null validation before writing some expression on that field. Please beak it down men's test part by part then can find that which part is giving null pointer exception.

View solution in original post

2 Replies
manodwhb
Champion II
Champion II

I am sure that null pointer exception will give when you have not handled null validation before writing some expression on that field. Please beak it down men's test part by part then can find that which part is giving null pointer exception.
sbarjatya
Contributor
Contributor
Author

Thanks for your reply. I tried part by part and when I replaced null with 0 in else statements ( see below). I am no longer getting nullPointerException error.
row2.len1Pd !=null&& row2.len1 !=null ?
(row2.len1Pd.equals("LF")?(row2.len1*365.25*80):
(row2.len1Pd.equals("YR")?(row2.len1*365.25):
((row2.len1Pd.equals("MO")||row2.len1Pd.equals("MN"))?(row2.len1*(365.25/12)):
(row2.len1Pd.equals("WK")?(row2.len1*7):
(row2.len1Pd.equals("HR")?(row2.len1/24):
(row2.len1Pd.equals("DA")?(row2.len1):0))))))
:0