java.util.zip.ZipException: invalid block type

Apache's JIRA Issue Tracker | Archie Cobbs | 1 year ago
tip
Do you know that we can give you better hits? Get more relevant results from Samebug’s stack trace search.
  1. 0

    When trying to GET any nzb files from http://nzbindex.nl with a httpclient request, a ZipException is raised. {code:title=JunitTestFailing.java} @Test public void testDeflateIssueFailing() throws ClientProtocolException, IOException { HttpGet httpget = new HttpGet("http://nzbindex.nl/download/72441827/BackTrack5R3.Gnome.iSO.32bit-LiNUX-0171-bt5r2gis32.par2.nzb"); HttpClient client = HttpClientBuilder.create().build(); HttpResponse response = client.execute(httpget); HttpEntity entity = response.getEntity(); byte[] data = EntityUtils.toByteArray( entity ); Assert.assertEquals( data.length, 423548 ); } {code} The complete stack trace I get is this: {code} java.util.zip.ZipException: invalid stored block lengths at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164) at java.io.FilterInputStream.read(FilterInputStream.java:107) at org.apache.http.client.entity.DeflateInputStream.read(DeflateInputStream.java:144) at org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:68) at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:136) at hclient.HTTPClientTest.testDeflateIssueFailing(HTTPClientTest.java:39) {code} A workaround I found is to set the Accept-Encoding header to only accept gzip, as follows: {code:title=JunitTestWorking.java} @Test public void testDeflateIssueWorking() throws ClientProtocolException, IOException { HttpGet httpget = new HttpGet("http://nzbindex.nl/download/72441827/BackTrack5R3.Gnome.iSO.32bit-LiNUX-0171-bt5r2gis32.par2.nzb"); httpget.setHeader("Accept-Encoding", "gzip"); HttpClient client = HttpClientBuilder.create().build(); HttpResponse response = client.execute(httpget); HttpEntity entity = response.getEntity(); byte[] data = EntityUtils.toByteArray( entity ); Assert.assertEquals( data.length, 423548 ); } {code} Thanks

    Apache's JIRA Issue Tracker | 1 year ago | Archie Cobbs
    java.util.zip.ZipException: invalid block type
  2. 0

    Facing java.util.zip.ZipException: invalid bit length repeat

    Stack Overflow | 1 year ago | Manoj Dudhe
    java.util.zip.ZipException: invalid bit length repeat
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    java.util.zip.ZipException: oversubscribed dynamic bit lengths tree

    Stack Overflow | 7 years ago | user157195
    java.util.zip.ZipException: oversubscribed dynamic bit lengths tree
  5. 0

    JSF restore state view - Front-end - GUJ

    com.br | 1 year ago
    java.util.zip.ZipException: invalid bit length repeat

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.zip.ZipException

      invalid block type

      at java.util.zip.InflaterInputStream.read()
    2. Java RT
      GZIPInputStream.read
      1. java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
      2. java.util.zip.GZIPInputStream.read(GZIPInputStream.java:116)
      2 frames
    3. Apache HttpClient
      LazyDecompressingInputStream.read
      1. org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:73)
      1 frame
    4. Java RT
      Reader.read
      1. sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
      2. sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
      3. sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
      4. java.io.InputStreamReader.read(InputStreamReader.java:184)
      5. java.io.Reader.read(Reader.java:140)
      5 frames
    5. Apache Http
      EntityUtils.toString
      1. org.apache.http.util.EntityUtils.toString(EntityUtils.java:247)
      2. org.apache.http.util.EntityUtils.toString(EntityUtils.java:291)
      2 frames
    6. Unknown
      Test.main
      1. Test.main(Test.java:22)
      1 frame