RFR: 8193682: Infinite loop in ZipOutputStream.close()
Ravi Reddy
rreddy at openjdk.java.net
Wed Sep 29 15:47:36 UTC 2021
On Fri, 17 Sep 2021 12:45:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Hi all,
>>
>> Please review this fix for Infinite loop in ZipOutputStream.close().
>> The main issue here is when ever there is an exception during close operations on GZip we are not setting the deflator to a finished state which is leading to an infinite loop when we try writing on the same GZip instance( since we use while(!def.finished()) inside the write operation).
>>
>> Thanks,
>> Ravi
>
> src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java line 249:
>
>> 247: out.close();
>> 248: closed = true;
>> 249: throw ioe;
>
> Have you tried using try-finally instead?
Hi Alan , Sorry for the delayed response , I was out of office for 3 weeks. I haven't tried with try-finally , I'm reworking on the fix as , if we directly use zip.finish() , we are facing the same issue. I will update here once the fix is ready.Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5522
More information about the core-libs-dev
mailing list