0

I am creating a standalone java application that will decompress a tar.gz into .tar file.

GZIPInputStream gZIPInputStream = new GZIPInputStream(is);

FileOutputStream fos = new FileOutputStream(tarFile);
byte[] buffer = new byte[2048];
int len;
while((len = gZIPInputStream.read(buffer)) > 0){
    fos.write(buffer, 0, len);
}

fos.close();
gZIPInputStream.close();

The below code works fine when running in eclipse but when I create a runnable jar and made it to run in Linux server its throwing the below error.

java.util.zip.ZipException: invalid code lengths set
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
        at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at com.bcs.wiposcrape.service.WipoDataServiceImpl.deCompressGZipFile(WipoDataServiceImpl.java:218)
        at com.bcs.wiposcrape.service.WipoDataServiceImpl.unZipFTPFiles(WipoDataServiceImpl.java:126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:206)
        at com.sun.proxy.$Proxy33.unZipFTPFiles(Unknown Source)
        at com.bcs.wiposcrape.launch.WipoScrape.scrapeLaunch(WipoScrape.java:56)
        at com.bcs.wiposcrape.launch.WipoScrape.main(WipoScrape.java:22)

The error is actually throwing from the 5th line of code snippet. Can someone please help me identify the real problem? Any help would be really appreciated.

jww
  • 97,681
  • 90
  • 411
  • 885
MPK
  • 105
  • 1
  • 10

0 Answers0