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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
YVES1
Contributor III
Contributor III

tJavaRow : null pointer exception with length() method

Hi ,
I built the job tFileInputExcel ------> tJavaRow ----> tLogRow
I am testing length of the column in the tJavaRow component with String chaine = input_row.Column1 then lg = chaine.length() but this latter is generating a null pointer exception.
Here enclosed 3 screenshots (job , tJavaRow code and null pointer exception error)

With best regards,
Yves.
Labels (3)
6 Replies
bdurand
Creator
Creator

Maybe input_row.Column1 is null.
You can try : if (chaine!=null) { lg = chaine.length(); }
regards,
YVES1
Contributor III
Contributor III
Author

Hi ,
I did this test as well but it fails as well.
A s soon as I manage input_row.Column1 with length() method or != null the result is null pointer exception.
Best regards,
Yves.
Anonymous
Not applicable

Hi
try if (!Relational.ISNULL(input_row.Column1)){
}
Anonymous
Not applicable

This will prevent even if that column have blank space.
if(input_row.Column1!=null && input_row.Column1.trim().length()>0){
String a = input_row.Column1.length();
}
YVES1
Contributor III
Contributor III
Author

Hi ,
I experienced the following if (!Relational.ISNULL(input_row.Column1)) suggested by lijolawrance and it works fine.
Thank you veru much.
Best regards,
Yves.
Anonymous
Not applicable

Hi Yves
Glad to hear that, thanks for your feedback!
Best regards
Shong