title: java: Zip Exception invalid codes length?
body: <p>When I'm writing entries into a zip file like this:</p>
  
  <pre><code>ZipEntry ze = zin.getNextEntry();
  while (ze != null) {
  InputStream is = zf.getInputStream(ze);
  zos.putNextEntry(ze);
  int len;
  while ((len = is.read(buffer)) &gt;= 0) {
     zos.write(buffer, 0, len);
  }
  
  zos.closeEntry();
  ze = zin.getNextEntry();
  
  }
  </code></pre>
  
  <p>I get the following exception on the second while loop:</p>
  
  <pre><code>java.util.zip.ZipException: invalid code lengths set
  
  at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
  
  at java.io.FilterInputStream.read(FilterInputStream.java:107)
  </code></pre>
  
  <p>Anybody knows why this exception is thrown and what does it mean?</p>
  
  <p>P.S. I should mention that I'm running this on a listeners on JBoss 7.1.1 in order to zip vaious log files from different folders. There's a thread for each folder. Could the fact of using multiple threads lead to this problem?</p>