java - IOException: Size Mismatch on inflated file error -


in android, have zip file need unzip, while unzipping end getting ioexception: size mismatch on inflated file: 6843932 v 0

i noticed when looking @ log see bunch of files unzipping.

geocoord/canada/nad27nad83/123w53n3d.dac, 85472 bytes. extracted 85472bytes. geocoord/canada/nad27nad83/bc27v1_1.dac, 48032 bytes. extracted 48032bytes. geocoord/canada/nad27nad83/readme_nad27tonad83.txt, 646 bytes. extracted 646bytes. geocoord/canada/nad83csrs/readme_nad83tocsrs.txt, 593 bytes. extracted 593bytes. geocoord/canada/readme_canada.txt, 534 bytes. extracted 534bytes. geocoord/coordsys.dty, 0 bytes. 

and code super simple:

private final int byte_size = 4096; private void unzip( string src, string target )   {   try         {         zipfile = new zipfile(src);         enumeration<? extends zipentry> entries = zipfile.entries();         while (entries.hasmoreelements())             {             zipentry entry = entries.nextelement();             file entrydestination = new file(target, entry.getname());             if (entry.isdirectory())                 entrydestination.mkdirs();             else                 {                 entrydestination.getparentfile().mkdirs();                 inputstream in = zipfile.getinputstream(entry);                 outputstream out = new fileoutputstream(entrydestination);                 log.i("log_me", entry.getname() + ", " + entry.getsize() + " bytes.");                 int len = 0;                 long count = 0;                 byte[] arr = new byte[byte_size];                 while ((len = in.read(arr)) > 0)                     {                     out.write(arr, 0, len);                     count += len;                     }                 out.flush();                 out.close();                 in.close();                 log.i("log_me", "extracted " + count + "bytes.");                 }             }         }      catch (exception e)         {         e.printstacktrace();         }              {         try             {                                                             if (zipfile != null)                 zipfile.close();             }          catch (exception e)             {             e.printstacktrace();             }         }     }   } 

so can see looks doing correctly.

is there sees out of ordinary? unzipped file, , shows file: geocoord/coordsy.dty has following statistics.

name          size  packed   type        modified     crc32  coordsys.dty  0     521,565  dty file    7/9/2015     441587f9 

did happen compression? seems might not have zipped files. (another colleague wrote zip)

i looking @ bash script zip , wrote this:

zipargs= -r -9  @$(srcroot)bsitools\winx86\zip.exe $(zipargs) $(ziptargetfile) $(zipsourcepath)  

and when looking @ zip.exe file shows commands follows:

copyright (c) 1990-1993 mark adler, richard b. wales, jean-loup gailly , kai uwe rommel. type 'zip -l' software license.  zip 2.0.1 (sept 18th 1993). usage: zip [-options] [-b path] [-t mmddyy] [-n suffixes] [zipfile list] [-xi list] default action add or replace zipfile entries list, can include special name - compress standard input. if zipfile , list omitted, zip compresses stdin stdout. -f   freshen: changed files  -u   update: changed or new files -d   delete entries in zipfile    -m   move zipfile (delete files) -k   simulate pkzip made zipfile  -g   allow growing existing zipfile -r   recurse directories     -j   junk (don't record) directory names -0   store                   -l   convert lf cr lf (-ll cr lf lf) -1   compress faster              -9   compress better -q   quiet operation              -v   verbose operation -c   add one-line comments        -z   add zipfile comment -b   use "path" temp file     -t   files after "mmddyy" -@   read names stdin        -o   make zipfile old latest entry -x   exclude following names  -i   include following names -f   fix zipfile (-ff try harder) -d   not add directory entries -t   test zipfile integrity       -l   show software license -$   include volume label         -s   include system , hidden files -h   show               -n   don't compress these suffixes 

i thinking -r -9 not enough zip. seems file doesnt zip files 1 level deep, other files correctly in subsequent directories.

edit: noticed printed out:

test of %my_path%geocoord.zip failed  zip error: zip file invalid or insufficient memory (original files unmodified) 

update:

the files being zipped symlink files , folders. recursively walks child folders fine files copying ptr, , not actual data.

the zip file tool zipping symlinks, symlinks showed size cause well, pointers. size off.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -