null values in context String variable

One Star

null values in context String variable

Hi all,
I detected a bad behavior in 5.0 (maybe corrected with last version).
-1 parent job (transmit whole context enabled)
--context.strVar1 = "toto"
--context.strVar2 not set
-1 child job
Default value context.strVar1 : null (type String)
Default value context.strVar2 : null (type String)
I transmit values through the child job context.

In child job :
tJava :
System.out.println("strVar1 ="+context.strVar1);
System.out.println("strVar2 ="+context.strVar2);
Result :
strVar1 =toto
strVar2 =null ====>NOT CORRECT it must be : strVar2 =
null value is recognized as a String !
Moderator

Re: null values in context String variable

Hi,
Did you check the KB article on TalendHelpCenterSmiley Tongueassing a value from a parent Job to a child Job to see if there any missing in your job setting.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: null values in context String variable

I can't get it - IMHO the referenced link/article does not solve the problem.
Look at this: http://www.talendbyexample.com/talend-null-handling.html
It seems to be a slightly bug or misconception in Talend.
One Star

Re: null values in context String variable

After I have tested with one parent job and a calling child job there was no transfer of "null" strings via Context. I have tested with Talend 5.3.1.
It seems to be a problem in Talend history.
Moderator

Re: null values in context String variable

Hi,
Did you open a jira issue on Talend Bug Tracker?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Seventeen Stars

Re: null values in context String variable

The "null"-Problem is caused by the Studio because it fills new String typed context variables with the String value "null". Go to the Context view and erase these nulls and that it. It is a bit annoying but not impossible.
But I agree with you that should not happen!
Sixteen Stars

Re: null values in context String variable

This is how Java works. Try this.....
String myNullVal = null;
System.out.println("The result of concatenating a String with a NULL is...." + myNullVal);
This is not a Talend issue, it is just the way Java works.