RFR [7021870] GzipInputStream closes underlying stream during reading

Alan Bateman Alan.Bateman at oracle.com
Sun May 12 19:16:04 UTC 2013


On 10/05/2013 23:48, Xueming Shen wrote:
> :
>
> So the proposed fix is more a workaround for this available() issue. The
> alternative is to fix the issue directly, for example, to change the 
> ZIS's
> available implementation to something like
>
>     public int available() throws IOException {
>         ensureOpen();
>         if (entryEOF || entry == null)
>             return 0;
>         switch (entry.method) {
>         case DEFLATED:
>             return (inf.finished() || inf.needsDictionary()) ? 0 : 1;
>         case STORED:
>             return remaining > 0 ? 1 : 0;
>         default:
>             throw new ZipException("invalid compression method");
>         }
>     }
>
> we probably should go further to simply remove the flag "entryEOF"
> and move the "deflated" case implementation into InflaterInputStream
> (to fix 7031075 as well).
>
Just catching up on this thread now. I agree the proposed patch is 
really a workaround and we should fix the real issue. The ZIS.available 
method that you propose looks fine for a first fix but it would be good 
to sort out 7031075 while we are in the area.

-Alan.



More information about the core-libs-dev mailing list