On Tue, 12 Oct 2021 14:46:33 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java line 256:
>> 
>>> 254:             } catch (Exception e) {
>>> 255:                 def.end();
>>> 256:                 out.close();
>> 
>> out.close not needed with try with resources.
>
> This changes deflate to close the compressor and the output stream when there 
> is an I/O exception. I expect this will need a spec change or a 
> re-examination of the issue to see if there are alternatives.

the out.close() call could be removed I guess. Leave it for user code to handle 
etc. Safer for spec also.

Main goal is to break the looping of the deflate call. The usesDefaultDeflater 
boolean might be useful in helping determine if def.end() should be called or 
not. If that boolean is false, then maybe we could just alter the input buffer 
by setting it to a size 0 buffer (ZipUtils.defaultBuf) -- worth a look.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5522

Reply via email to