Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 https://community.talend.com/t5/Archive/problem-with-tFileUnarchive/td-p/63201, 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
Labels (3)
4 Replies
Anonymous
Not applicable
Author

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

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

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

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