You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2016-08-11 14:36:11

francois.gaudin
Member
9 posts

francois.gaudin said:

tFileUnarchive - How to know if the zip is invalid or has no entries?

Hello,

I have a question concerning the tFileUnarchiveComponent.  I'm using it on some zip files, some of which may be invalid and some of which may have no entries.  I would like to link to a component when an invalid zip file is encountered and I'd like to know if there are no rows (ie. no files) from a particular zip.
(Surprisingly, the onComponentError flow is not activated when there is an invalid zip.)

I'd be very grateful for any links to solutions or ideas for alternatives...

Thanks!

Offline

#2 2016-08-12 04:59:59

xdshi
Talend Team


xdshi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi,
Could you please take a look at component TalendHelpCenter:tFileProperties which obtains information about the main properties of a defined file.
There is  a "size" schema (the file size in bytes). You can use it to check your invalid file with no entry(the file size should be 0).
Best regards
Sabrina


What we can do is to make sure that Talend will be your best choice!

Offline

#3 2016-08-12 07:49:58

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi Sabrina,
Thanks for the reply.  So I can use this component to determine if a zip file is empty.  But what if a zip file is corrupt and can't be opened by the tFileUnarchive component?  Is there any way of knowing this?  The component logs an error but the onComponentError does not seem to be called when the archive is invalid...  

François

Offline

#4 2016-08-12 10:14:42

xdshi
Talend Team


xdshi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi,
What's kind of component error message you are getting?
OnComponentError will trigger the sub-job or component as soon as an error is encountered in the primary Job
Best regards
Sabrina


What we can do is to make sure that Talend will be your best choice!

Offline

#5 2016-08-12 11:40:50

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

When using a corrupt zip, the tFileUnarchive component writes "archive is not a ZIP archive" in the log.  If "Check the integrity before unzip" is checked then it writes "The file <xxx> is corrupted, process terminated..." to the log.
But in neither case is the onComponentError triggered.  I was expecting to be able to use that trigger to determine that an archive is invalid...
Thanks,
François

Offline

#6 2016-08-12 15:59:25

cterenzi
Member
93 posts

cterenzi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

I was able to trigger onComponentError execution by checking "Die on Error" in tFileUnarchive's settings. Will that help you?

Offline

#7 2016-08-12 16:25:26

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Thanks.  That would be logical.  I tried that but am still just getting an error in the log and the onComponentError does not get triggered.  Maybe I'm missing some global configuration - will look into that possibility...
Thanks again.

Offline

#8 2016-08-15 08:20:57

xdshi
Talend Team


xdshi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi François.
Is there any update for your issue?
Best regards
Sabrina


What we can do is to make sure that Talend will be your best choice!

Offline

#9 2016-08-18 10:07:55

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi Sabrina,
I tried cterenzi's solution but if I check "Die on error" the onComponentError still does not get triggered.  Is this behavior that can be configured?
Regards,
François

Offline

#10 2016-08-18 10:15:27

xdshi
Talend Team


xdshi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi,
Would you mind sending an invalid zip file(corrupt, can not open by tFileUnarchive component)to us? In this way, we can make a simple testing for your use case.
Is your job design:tFileUnarchive-->oncomponenterror-->tfileinputproperties?
Best regards
Sabrina


What we can do is to make sure that Talend will be your best choice!

Offline

#11 2016-08-22 12:41:09

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

I use any file that is not a zip file (e.g. the one attached).  The tFileUnarchive component logs "archive is not a ZIP archive" when "Check the integrity before unzip" is unchecked.  When that option is checked then I get "The file C:/tools/talend_workspace/archive.zip is corrupted, process terminated...".

In neither case does the OnComponentError get triggered.
archive.zip_20160822-0440.zip

Offline

#12 2016-08-24 09:50:26

xdshi
Talend Team


xdshi said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi,
The attachment you provided is not avaliable on talend forum. Could you please take a look at it?
Best regards
Sabrina


What we can do is to make sure that Talend will be your best choice!

Offline

#13 2016-08-30 10:05:17

francois.gaudin
Member
9 posts

francois.gaudin said:

Re: tFileUnarchive - How to know if the zip is invalid or has no entries?

Hi,
The zip may have been blocked by my firewall.  It doesn't matter, you can use any file that is not a zip file e.g. Take a jpg and rename it .zip to obtain an invalid zip file.  When you try to unzip it with the tFileUnarchive component you will get the behavior described in my previous post i.e. OnComponentError does not get triggered.
Best,
François

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy