Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
CatherineT
Contributor II

In tMap, my variable can't be null : java.lang.NullPointerException error

Hello,

 

I need to create a variable in the middle part of a tMap component.

This variable should be a byte type variable.

 

It is calculated by testing a char type input data (through a global routine) :

 

If CharData = 'A' Then 1

Else if CharData = 'B' Then 0

Else null

 

The problem is that I have the following message error : java.lang.NullPointerException

I think that it is due to the fact that the variable is null because the char data is blank.

 

Does it mean that a variable can't be null ?!

Labels (3)
1 Solution

Accepted Solutions
corentin1
Contributor III

In your screenshot, var1 is not set as "nullable". Make sure that in tMap you have checked the 'nullable' checkbox , which is near the name of your variable (unchecked by default)

View solution in original post

5 Replies
jlolling
Creator III

It depends how you have configured the variable. If the variable is also not null configured that you will get this Exception.

Anonymous
Not applicable

Hello,

Could you please post your tMap component setting screenshots here which will be helpful for us to address your issue?

Best regards

Sabrina

CatherineT
Contributor II
Author

Hello,

 

Here is the job I use to test.

 

0695b00000aGxpsAAC.png0695b00000aGxpxAAC.pngThis is working :

0695b00000aGxqWAAS.png0695b00000aGxqlAAC.png 

But I need to calculate QCDemandeNu in the middle part of the tMap, because I'll use it to calculate other variables.

So this the tMap I would like to use :

0695b00000aGxrPAAS.png0695b00000aGxrZAAS.png0695b00000aGxreAAC.pngThe problem is that I can't use the type Byte (which allows null values) in the variable part, whereas I can in the output part of the tMap.

 

corentin1
Contributor III

In your screenshot, var1 is not set as "nullable". Make sure that in tMap you have checked the 'nullable' checkbox , which is near the name of your variable (unchecked by default)

CatherineT
Contributor II
Author

Thank you very much Corentin !

Iv've never noticed that checkbox before !!!

 

0695b00000bDkv2AAC.png 

"The devil is in the details"