Error/Failure handling with tFileDelete

One Star

Error/Failure handling with tFileDelete

Dear Readers,
In our Talend Job there is a tFileDelete component that cleans the content of a directory.
However we need handle the case when at least one file could not be deleted.
When the job executes all files but not the locked ones are deleted. These circumstance
should trigger the mechanism "fail on error" but it is not. The link to "on subjob error"
is not taken by the flow.
Kind regards,
Hilderich
One Star

Re: Error/Failure handling with tFileDelete

Do you have "fail on error" checked in the component?
If that doesn't work, you may try checking if there is an error message after the component executes.
((String)globalMap.get("tFileDelete_1_ERROR_MESSAGE"))
Seventeen Stars

Re: Error/Failure handling with tFileDelete

The file delete component is a bit strange designed!
After delete the given file the success can only be seen by this check:
"File deleted.".equals((String) globalMap.get("tFileDelete_1_CURRENT_STATUS"))

This boolean expression can be used in the if trigger.
For me this component is very bad designed. Why they do not have added a usable return value like DELETE_OK or let the component die if it does not work.
Actually if have not seen any difference in the code for fail-on-error. Probably a bug.