RFR JDK-7031075: GZIPInputStream's available() reports 1, but read() gives -1.

Xueming Shen xueming.shen at oracle.com
Tue Jul 12 22:06:00 UTC 2016

ping. simple fix.

On 7/11/16, 3:53 PM, Xueming Shen wrote:
> Hi,
> Please help review the change for JDK-7031075.
> issue: https://bugs.openjdk.java.net/browse/JDK-7031075
> webrev: http://cr.openjdk.java.net/~sherman/7031075/webrev
> This is a corner case in current implementation, in which the "readEOF"
> flag is only set when/after the read/skip method is invoked and the "eof"
> is "explicitly" reached. Which means even the inflater has reached the
> "end of the compressed stream" (inf.finished() == true) during the last
> read/skip invocation (since there are still data available, so the 
> date gets
> read/returned successfully), the readEOF is not set, and therefor the
> available() return > 0 if checked.
> The proposed change here is to do an extra check of the inf.finished(),
> if it returns true, means there is no more data inside the inflater the
> end of compressed stream has been reached, available() returns true
> in this case.
> Thanks,
> Sherman

More information about the core-libs-dev mailing list