Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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!
Labels (2)
16 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
cterenzi
Specialist

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

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.
Anonymous
Not applicable
Author

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

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
Anonymous
Not applicable
Author

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