title: java.util.zip.ZipException: invalid compression method
body: <p>I am having some issues in dealing with zip files on Mac OS X 10.7.3.</p>
  
  <p>I am receiving a zip file from a third party, which I have to process. My code is using ZipInputStream to do this. This code has been used several times before, without any issue but it fails for this particular zip file. The error which I get is as follows:</p>
  
  <pre><code>java.util.zip.ZipException: invalid compression method
      at java.util.zip.ZipInputStream.read(ZipInputStream.java:185)
      at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:105)
      at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  </code></pre>
  
  <p>I googled about it and I can see that there are some issues with ZipInputStream, e.g. <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4419591" rel="nofollow noreferrer">this one</a>.</p>
  
  <p><strong>I have also found some related questions on Stackoverflow, e.g. <a href="https://stackoverflow.com/questions/325202/java-util-zip-zipexception-error-in-opening-zip-file">this one</a>. But there is no proper, accepted/acceptable answer.</strong> </p>
  
  <p>I have a couple questions:</p>
  
  <ol>
  <li>Has anyone found any concrete solution for this? Like any lates
  update or an all together different JAR which has same functionality
  but no issues</li>
  <li>On this <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4505111" rel="nofollow noreferrer">link</a>, the user <strong>phobuz1</strong> mentions that <strong><em>"if
  non-standard compression method (method 6)"</em></strong> is used, then this
  problem occurs. Is there a way to find out which compression method
  is used? So that I can be sure of the reason of failure?</li>
  </ol>
  
  <p>Note that as with some users, if I unzip the file on my local machine and re-zip it, it works perfectly fine.</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>The file which I am getting is in <code>.zip</code> format, I don't know which OS/utility program they are using to compress it. On my local machine I am using the built-in zip utility which comes with Mac OS X.</p>