One Star

[resolved] File Trigger: send attachment if file < # bytes, dont if not

***NEVERMIND***
So when I made a copy of tSendMail_1, I deleted the text that was in the Attachment list, but I didn't delete the entry. Hence the problem.
Sorry to bother.


I'm trying to set up a, very simple, job that runs when triggered by the specified file trigger in the WUI. (Right now I'm using the tFileList_1 just to pull the files for testing. I'll take it out when I get this working right and can run it through the WUI.)
I want it to send the triggering file as an attachment, as long as the file isn't too big to be attached (I'm using 9,500,000 bytes as my max).
If the file is too big to be attached, I want an email to be sent without it.
But I'm getting this error when I enable the 2nd tSendMail component, the one thats supposed to send the email without the attachment if the file is too big:
Starting job Email_FileTrigger at 11:32 01/08/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method add(String) in the type List<String> is not applicable for the arguments ()
at generic.email_filetrigger_0_1.Email_FileTrigger.tFileList_1Process(Email_FileTrigger.java:1318)
at generic.email_filetrigger_0_1.Email_FileTrigger.runJobInTOS(Email_FileTrigger.java:2137)
at generic.email_filetrigger_0_1.Email_FileTrigger.main(Email_FileTrigger.java:2022)
Job Email_FileTrigger ended at 11:32 01/08/2008.

The job will run without errors if I have both tSendMails disabled (pic 1) or if I have only tSendMail_1 enabled (pics 2 & 3). But will not run if tSendMail_2 is enabled (pics 4 & 5).
The logic in tSendMail_1 is almost identical to whats in tSendMail_2 (pics 8 & 9), except that there is no attachment file listed in 2 and they each reference the rows that are feeding them.
I tried changing the conditions in tMap (pics 6 & 7), but that didn't make a difference.
Anyways, it looks like that logic is splitting the files like I want it to (see the red boxes in pics 1 & 2) - its sending the file thats < 9,500,000 bytes to tLogRow_1 and the file thats > to tLogRow_2

tSendMail_1 Message:
"***Triggering File Info***"+"\n"
+"File Name: "+context.fileName+"\n"
+"File Path: "+context.filePath+"\n"
+"Last Modified Date: "+row2.mtime_string+"\n"
+"Size: "+row2.size+"\n"
+"\n"
+"***Trigger Settings***"+"\n"
+"Folder Path: "+context.folderPath+"\n"
+"File Mask: "+context.fileMask+"\n"
+"\n"
+"***Job Information***"+"\n"
+"Project: "+projectName+"\n"
+"JobName: "+jobName+"\n"
+"tFileProperties Error Message: "
+((String)globalMap.get("tFileProperties_1_ERROR_MESSAGE"))

tSendMail_2 Message:
"***Triggering File Info***"+"\n"
+"File Name: "+context.fileName+"\n"
+"File Path: "+context.filePath+"\n"
+"Last Modified Date: "+row3.mtime_string+"\n"
+"Size: "+row3.size+"\n"
+"\n"
+"***Trigger Settings***"+"\n"
+"Folder Path: "+context.folderPath+"\n"
+"File Mask: "+context.fileMask+"\n"
+"\n"
+"***Job Information***"+"\n"
+"Project: "+projectName+"\n"
+"JobName: "+jobName+"\n"
+"tFileProperties Error Message: "
+((String)globalMap.get("tFileProperties_1_ERROR_MESSAGE"))

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] File Trigger: send attachment if file < # bytes, dont if not

Hello strpdsnk
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method add(String) in the type List<String> is not applicable for the arguments ()

On tSendMail_2 component, you have add a attachment file line, but you set nothing. You will see the wrong code in generated code
attachments_tSendMail_2.add();  // The code is wrong.

So, please remove the empty line in attachment file filed.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
1 REPLY
Community Manager

Re: [resolved] File Trigger: send attachment if file < # bytes, dont if not

Hello strpdsnk
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method add(String) in the type List<String> is not applicable for the arguments ()

On tSendMail_2 component, you have add a attachment file line, but you set nothing. You will see the wrong code in generated code
attachments_tSendMail_2.add();  // The code is wrong.

So, please remove the empty line in attachment file filed.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business