invalid literal/length code

JDK Bug System | Nelson Dcosta | 7 years ago
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Bug ID: JDK-6907252 ZipFileInputStream Not Thread-Safe | 2 months ago invalid literal/length code
  2. 0

    FULL PRODUCT VERSION : java version "1.6.0_17" Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows Version 5.1 (Build 2600.xpsp_sp3_gdr.090804-1435 : Service Pack 3) A DESCRIPTION OF THE PROBLEM : Using an InputStream of a ZIP file entry seems not thread safe, and may even crash the VM. Below you'll find two crash reports. The first one is from my test run, the second one from the real issue we've encountered. It happens when reading an animating an animated GIF as a resource from a JAR file. Notice that the affected code is the AWT ImageFetcher. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : See test program. It's timing issue, so you may have to play with it for a while. I think the access violation happens at the following line, while accessing csize of a (already closed?) NULL entry, in function ZIP_Read: zip_util.c:1081 jlong entry_size = (entry->csize != 0) ? entry->csize : entry->size; EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The exception that happens most of the time is quite good. Unexpected end of ZLIB input stream at$1.fill( at at at CrashTest.main( ACTUAL - From time to time, there's a ZipException instead of the EOFException, with varying, less helpful, messages. invalid literal/length code at at at CrashTest.main( Other messages are: oversubscribed dynamic bit lengths tree invalid stored block lengths invalid block type The real problem is that the issue makes the VM crash some times - refer stack trace. ERROR MESSAGES/STACK TRACES THAT OCCUR : Attached seperatly REPRODUCIBILITY : This bug can be reproduced rarely. ---------- BEGIN SOURCE ---------- Any JAR with any file should do. Just make the entry big enough for the timer to hit the reading loop. import; import; import; import; import java.util.Timer; import java.util.TimerTask; import; import; public class CrashTest { public static void main(final String[] args) throws Exception { final Timer timer = new Timer(); while (true) { final ZipFile zip = new ZipFile(new File("test.jar")); try { final ZipEntry entry = zip.getEntry("test.gif"); final InputStream in = zip.getInputStream(entry); try { timer.schedule(new TimerTask() { @Override public void run() { try { in.close(); } catch (final IOException ex) { ex.printStackTrace(System.err); } } }, 10); int c; do { c =; } while (c != -1); } finally { in.close(); } } catch (final EOFException ex) { // "Unexpected end of ZLIB input stream" } catch (final Exception ex) { ex.printStackTrace(System.err); } finally { zip.close(); } } } } ---------- END SOURCE ----------

    JDK Bug System | 7 years ago | Nelson Dcosta invalid literal/length code
  3. 0

    Failed to stop bean 'endpointMBeanExporter' error during deployment of a Spring Boot jar

    Stack Overflow | 1 year ago | uhsarp
    java.lang.NoClassDefFoundError: org/springframework/context/support/DefaultLifecycleProcessor$1
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java -jar fails to read aspectjrt 1.7.4

    GitHub | 3 years ago | PerGon
  6. 0

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

    GitHub | 3 years ago | sincang
    java.lang.NoClassDefFoundError: com/rabbitmq/client/impl/ConsumerDispatcher$6

    15 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


      invalid literal/length code

    2. Java RT
      2 frames
    3. Unknown
      1. CrashTest.main(
      1 frame