java.util.zip.ZipException: invalid stored block lengths

Apache's JIRA Issue Tracker | Guillaume Serre | 2 years ago
  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 | 2 years ago | Guillaume Serre
    java.util.zip.ZipException: invalid stored block lengths
  2. 0

    java -jar fails to read aspectjrt 1.7.4

    GitHub | 3 years ago | PerGon
    java.lang.reflect.InvocationTargetException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    java.lang.NoClassDefFoundError: com/rabbitmq/client/impl/ConsumerDispatcher$6

    GitHub | 2 years ago | sincang
    java.lang.NoClassDefFoundError: org/springframework/amqp/rabbit/support/RabbitExceptionTranslator

    13 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 stored block lengths

      at java.util.zip.InflaterInputStream.read()
    2. Java RT
      InflaterInputStream.read
      1. java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
      1 frame
    3. Apache HttpClient
      LazyDecompressingInputStream.read
      1. org.apache.http.client.entity.DeflateInputStream.read(DeflateInputStream.java:153)
      2. org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:73)
      2 frames
    4. Java RT
      Reader.read
      1. sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
      2. sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
      3. sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
      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. httpclient
      HttpClient1550.testDeflateIssue
      1. httpclient.HttpClient1550.testDeflateIssue(HttpClient1550.java:47)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    8. JUnit
      ParentRunner.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      13. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      14. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      14 frames
    9. JUnit4 Provider
      JUnit4Provider.invoke
      1. org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
      2. org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
      3. org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
      3 frames
    10. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    11. SureFire
      ForkedBooter.main
      1. org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      2. org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      3. org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      4. org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
      5. org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      5 frames