--- old/src/share/classes/java/util/zip/ZipFile.java Thu Apr 10 11:04:51 2014 +++ new/src/share/classes/java/util/zip/ZipFile.java Thu Apr 10 11:04:51 2014 @@ -700,25 +700,27 @@ } public int read(byte b[], int off, int len) throws IOException { - if (rem == 0) { - return -1; - } - if (len <= 0) { - return 0; - } - if (len > rem) { - len = (int) rem; - } synchronized (ZipFile.this) { - ensureOpenOrZipException(); + long rem = this.rem; + long pos = this.pos; + if (rem == 0) { + return -1; + } + if (len <= 0) { + return 0; + } + if (len > rem) { + len = (int) rem; + } + ensureOpenOrZipException(); len = ZipFile.read(ZipFile.this.jzfile, jzentry, pos, b, off, len); + if (len > 0) { + this.pos = (pos + len); + this.rem = (rem - len); + } } - if (len > 0) { - pos += len; - rem -= len; - } if (rem == 0) { close(); }