From 094af1e7940aa505c072897d3594a359b2b155bc Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 26 Feb 2014 14:24:18 -0700 Subject: [PATCH] remove redundant decrement in ZipFile.getInputStream inner class We were decrementing the "remaining" field twice for each byte read using the no-arg read method, which resulted in available() returning a value that was too small. --- classpath/java/util/zip/ZipFile.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/classpath/java/util/zip/ZipFile.java b/classpath/java/util/zip/ZipFile.java index 8a675ef8fe..b6cc43d1df 100644 --- a/classpath/java/util/zip/ZipFile.java +++ b/classpath/java/util/zip/ZipFile.java @@ -103,11 +103,9 @@ public class ZipFile { int remaining = uncompressedSize(window, pointer); public int read() throws IOException { - int c = super.read(); - if (c >= 0) { - -- remaining; - } - return c; + byte[] buffer = new byte[1]; + int c = read(buffer); + return (c < 0 ? c : (buffer[0] & 0xFF)); } public int read(byte[] buffer) throws IOException {