One Star

tSystem AND run if

Hello,
I want to use a procedure run if when I run in my component tSystem_1 a script, which finishes successfully.

This is the output of the script in the tSystem component:
Everything is Ok
Files: 20
Size: 64479954
Compressed: 6950205
disconnected

The If-run condition :
((String)globalMap.get("tSystem_1_OUTPUT")).matches(".*Compressed.*")

But I have an error :
Exception in component tSystem_1
java.lang.NullPointerException
at bader_fpo.test_unarchive_7z_0_1.test_unarchive_7z.tFileList_1Process(test_unarchive_7z.java:317)
at bader_fpo.test_unarchive_7z_0_1.test_unarchive_7z.runJobInTOS(test_unarchive_7z.java:2599)
at bader_fpo.test_unarchive_7z_0_1.test_unarchive_7z.main(test_unarchive_7z.java:2507)
Everything is Ok
Files: 20
Size: 64479954
Compressed: 6950205
disconnected]

Why this problem ?
I helped me with this topic : http://www.talendforge.org/forum/viewtopic.php?id=2697
Thank you for you help.
4 REPLIES
One Star

Re: tSystem AND run if

I'd try sending yourself an email with ((String)globalMap.get("tSystem_1_OUTPUT")) as the Message to see what is being output. Your problem could be you're trying to search information that just isn't in the output.
"Err Msg: "+((String)globalMap.get("tSystem_1_ERROR_MESSAGE"))+"\n"
+"Err Output:" +((String)globalMap.get("tSystem_1_ERROROUTPUT"))+"\n"
+"Exit Val:"+((Integer)globalMap.get("tSystem_1_EXIT_VALUE"))+"\n"
+"Output:"+((String)globalMap.get("tSystem_1_OUTPUT"))+"\n"
One Star

Re: tSystem AND run if

Also, check what you have "Standard Output" and "Error Output" set to for tSystem
For me, "to console" sends the info to the Run tab (and command window) only. And this is what gets sent as an email
Err Msg: null
Err Output:null
Exit Val:0
Output:null

Try setting them to "to global variable", if you haven't done that already.
Err Msg: null
Err Output:null
Exit Val:0
Output:
BloombergReformat Application - Ver 1.0 - March 26, 2008 Run time : 6/17/2008 5:31:18 PM
Application terminated on 6/17/2008 5:31:18 PM.
Number of columns processed: 78
Number of rows processed: 9
One Star

Re: tSystem AND run if

Thank you for your sugestion.
Now, in parameters of tSystem, I choose
Standart Output : to global variable

I did a test with a condition "main" and a messagebox and it works !
But when I want to use run-if condition with that :
((String)globalMap.get("tSystem_1_OUTPUT")).matches(".*Compressed.*")

It doesn't work !
Help me please
One Star

Re: tSystem AND run if

Now, in parameters of tSystem, I choose
Standart Output : to global variable

I did a test with a condition "main" and a messagebox and it works !

Personally, I would do it for "Error Output" as well, so you don't get another NullPointerException if there is an error in tSystem
But when I want to use run-if condition with that :
((String)globalMap.get("tSystem_1_OUTPUT")).matches(".*Compressed.*")

It doesn't work !

My guess would be its the periods between your matches parentheses.
Maybe this will work?
((String)globalMap.get("tSystem_1_OUTPUT")).matches("*Compressed*")