Problem with tFileList and tFileUnarchive

One Star

Problem with tFileList and tFileUnarchive

Within a java project,
I'm trying to unzip all files in a given directory. I can't make it work: (same problem as http://www.talendforge.org/forum/viewtopic.php?id=1208, but with java), I still have a java exception:
Exception in component tFileUnarchive_1
java.io.IOException: Negative seek offset
at java.io.RandomAccessFile.seek(Native Method)
at org.apache.tools.zip.ZipFile.positionAtCentralDirectory(ZipFile.java:365)
at org.apache.tools.zip.ZipFile.populateFromCentralDirectory(ZipFile.java:243)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:142)
at org.apache.tools.zip.ZipFile.<init>(ZipFile.java:113)
at proto.perfweb.PERFWEB.tFileList_1Process(PERFWEB.java:237)
at proto.perfweb.PERFWEB.runJob(PERFWEB.java:413)
at proto.perfweb.PERFWEB.main(PERFWEB.java:360)
Is it a bug ? Here there any other way to do it ?
Please find the détails in the images below
Community Manager

Re: Problem with tFileList and tFileUnarchive

Hi bobby
Which version of TOS did you use? I have tested this problem on my computer and it runs fine.
My project: windowXP, TOS2.2.0M2, Java
I unzip the .zip files in my project. please see the screenshots:
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Problem with tFileList and tFileUnarchive

Thank you for your answer.
Indeed, if I replace the .gz file (created with linux) by .zip file (created with windows), then it works
However, its is strange:

file.zip-> tFileUnarchive -> OK
file.gz -> tFileUnarchive -> OK
dir/*gz -> tFileList -> tFileUnarchive -> KO
dir/*zip -> tFileList -> tFileUnarchive -> OK
why do the unarchive works with just one gz file but not with the filelist ?
I've tried every latest version of TOS
Thank you for your help
Highlighted
Community Manager

Re: Problem with tFileList and tFileUnarchive

Hi Bobby
It is a bug from the component. You can see it here: http://talendforge.org/bugs/view.php?id=2103
it will unzip the file in zip by default
file.gz -> tFileUnarchive -> OK,
code:
java.util.zip.GZIPInputStream zip_tFileUnarchive_1 = new java.util.zip.GZIPInputStream(
new java.io.FileInputStream(new java.io.File(
zipFileURL_tFileUnarchive_1)));

file.gz -> tFileList -> tFileUnarchive -> KO
code:
String zipFileURL_tFileUnarchive_1 = ((String) globalMap
.get("tFileList_1_CURRENT_FILEPATH"));

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Problem with tFileList and tFileUnarchive

Thank you very much
I will closely follow this bug evolution
Best Regards

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch