On Mon, 1 Jan 2024 16:12:13 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> Specification: This change brings the implementation of > DeflaterOutputStream.close() in line with its specification: Writes remaining > compressed data to the output stream and closes the underlying stream. > Risk: This is a behavioural change. There is a small risk that existing code > depends on the close method not following its specification. I think this won't require a CSR since the change is merely fixing an issue and making it comply with the specification. src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java line 249: > 247: def.end(); > 248: } > 249: out.close(); This call has a potential to throw an `IOException` in which case any original `IOException` thrown from the `finish()` call will be lost. Perhaps we should do something like: public void close() throws IOException { if (!closed) { IOException finishFailure = null; try { finish(); } catch (IOException ioe){ finishFailure = ioe; } finally { if (usesDefaultDeflater) { def.end(); } try { out.close(); } catch (IOException ioe) { if (finishFailure != null) { ioe.addSuppressed(finishFailure); } throw ioe; } closed = true; } } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/17209#issuecomment-1873737464 PR Review Comment: https://git.openjdk.org/jdk/pull/17209#discussion_r1439238691