Four Stars

How do I handle an exception

Hi,

 

I am facing below error in tfileinputexcel component :

Exception in component tFileInputExcel_1
java.lang.ArrayIndexOutOfBoundsException: 1120256

 

this is because I have a corrupted file in input , but I want my job to run with non-corrupted file and handle this exception. Could you please help.

Neha
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: How do I handle an exception

The exception is thrown in child job, so you can use a tLogCatcher in the child job to capture the exception error and log them to a file or db.

----------------------------------------------------------
Talend | Data Agility for Modern Business
10 REPLIES
Moderator

Re: How do I handle an exception

Hello,

Can you open your corrupted file with MS Excel? Are you able to create 'File Excel' in metadata wizard?

Here is online document about:TalendHelpCenter:Centralizing File Excel metadata.

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.
Four Stars

Re: How do I handle an exception

Hi, Thanks for the response.
No I cannot open the corrupted file with MS excel, It comes with a bunch of other files with same file mask and it is stopping to process the other input files available in the folder.
I want to catch an exception where it just populate a message saying that "corrupted file ignored" , so that I dont get a big red error message and non process of data at all.

Let me know if you need any more info or screenshot.
Neha
Moderator

Re: How do I handle an exception

Hello,

Are you trying to retrieve a set of files or folders based on  a filemask pattern and iterates on each unity?

What does your current job design look like?

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.
Four Stars

Re: How do I handle an exception

Hi Sabrina,

 

Let me explain you more on this :

I am working on exception handling scenarios , where i have 5 input files in a folder, and one of them is corrupted and the job is throwing below error  :

Exception in component tFileInputExcel_1
java.lang.ArrayIndexOutOfBoundsException: 1120256
at jxl.read.biff.Record.<init>(Record.java:79)
at jxl.read.biff.File.next(File.java:181)
at jxl.read.biff.SheetImpl.<init>(SheetImpl.java:300)
at jxl.read.biff.WorkbookParser.parse(WorkbookParser.java:803)
at jxl.Workbook.getWorkbook(Workbook.java:271)
at test job

This is affecting the job while processing other non-corrupted files.

 

What I want to achieve is :

Catch the exception and process the job with non-corrupted files. 

The similar scenario can be as per below :

For example : I have total 5 input files , but one of them has a different sheet name. So It will throw "Special sheet does not exists error",

But I still want to process the job with the files which have correct sheet names in them.

 

I hope now Im able to explain better. Job flow is :

 

tfilelist---iterate--> iFileinputexcel---main-->tlogrow

 

I even tried with on component error trigger on tDie , but its not working somehow.

 

Could you please help in this. 

Thanks

 

Neha
Moderator

Re: How do I handle an exception

Hello,

Make sure you have cleared 'Die on error' option on tfileinputexcel component to skip the row on error and complete the process for error-free rows.

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.
Four Stars

Re: How do I handle an exception

Hi,

I already did that and its still not working, I have attached screen shot now.
Regards,
Neha

Neha
Four Stars

Re: How do I handle an exception

Can someone please help in this requirement. 

Neha
Community Manager

Re: How do I handle an exception

Hi
You need to redesign the job as below:
main job:
tFileList--iterate--tRunjob

on tRunJob: pass the current file path to child job, see
https://community.talend.com/t5/Design-and-Development/Passing-a-value-from-a-parent-Job-to-a-child-...
and uncheck the 'die on error' option.

child job:
tfileinputXML--main--tlogrow

The main job will continue to iterate next file even though the child job has an error.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: How do I handle an exception

Thank you for the response Shong.

Further to add in this, what if I want to catch this exception (Print a message in the log so I can know the exception)that one file is corrupted or Sheet does not exists.

and exit the job with code 1.

 

Any solution for that please. 

 

Best Regards,

Neha

Neha
Community Manager

Re: How do I handle an exception

The exception is thrown in child job, so you can use a tLogCatcher in the child job to capture the exception error and log them to a file or db.

----------------------------------------------------------
Talend | Data Agility for Modern Business