Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For one Talend job, I use the tJava component to replace the name of the current file
Code:
String currentFileName = ((String)globalMap.get("tFileList_1_CURRENT_FILE"));
String newCurrentFileName = null;
String pattern = ((String)globalMap.get("Stichtag"));
String replacement = "20181010";
if (currentFileName.contains(pattern)){
newCurrentFileName = currentFileName.replaceAll(pattern, replacement);
globalMap.put(((String)globalMap.get("tFileList_5_CURRENT_FILE")), newCurrentFileName);
}
But if I’ll execute this Job I get an exception:
Exception in component tJava_3
java.lang.NullPointerException
Do you have any ideas, what is wrong?
Thanks in advance
That is good news 🙂
Could you please mark the topic as resolved so that it will help our Talend community members?
Warm Regards,
Nikhil Thampi
Hi,
In first step, you are using tFileList_1_CURRENT_FILE but in later step you are using tFileList_5_CURRENT_FILE.
Could you please print and see the value in the variables to make sure that it is havign right values?
Warm Regards,
Nikhil Thampi
Hello,
yes, you are right. It was written by mistake. Now it works fine.
Thank you very much.
That is good news 🙂
Could you please mark the topic as resolved so that it will help our Talend community members?
Warm Regards,
Nikhil Thampi