Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
vapukov
Master II
Master II

tMap strange null pointer error

Hi all,

 

just maybe somebody meets with similar case:

 

Source structure:

0683p000009M5SR.png

 

 

Next tMap code, works as expected:

row1.event.equals("TEXT")?
null
:row1.validAfter==null?
null
:Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validAfter) ) 

but similar extended construction:

row1.event.equals("TEXT")?
null
:row1.isPermanent==1L?
-1L
:row1.validUntil==null?
null
:Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validUntil) ) 

not!

 

each part of wrong code work fine, and current solution - 

replaced by SQL CASE at source for validUntil:

row1.event.equals("TEXT")?
null

tMap for out.validUntil_Long

row1.validUntil==null?
null
:Long.valueOf(TalendDate.formatDate("yyyyMMddHH",row1.validUntil) ) 

tjavaRow

if (row1.isPermanent==1L) {
out.validUntil_Long = -1L;
}

3 step work as expected, but all together - not

 

Java 8, Windows

 

 

solutions it work well, just interesting - why? is it an error in the my IF code, error in talend or java version specific issue?

regards, Vlad

 

Labels (1)
3 Replies
Anonymous
Not applicable

I can't see anything immediately obvious I'm afraid. The only thing that looks like it might lead to a null pointer exception is the row1.event.equals("TEXT") code. However, your working solution has this as well.

vapukov
Master II
Master II
Author

I will test it later, what source of error - mix of types or construction

 

I have multi conditions constructions for string only and all work as expected

 

at the same time I have working constriction like:

condition?
(condition? (condition? true : false) : false)
:(condition? true : (condition? true : false))

and it works with different types

 

so need to find a time and simulate test cases 

 

Thank you for the answer Richard!

 

Anonymous
Not applicable

Thank for answer