RFR: 8313739: ZipOutputStream.close() should always close the wrapped stream [v2]
Eirik Bjørsnøs
eirbjo at openjdk.org
Tue Jan 2 09:18:46 UTC 2024
On Tue, 2 Jan 2024 08:35:47 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> This call has a potential to throw an `IOException` in which case any original `IOException` thrown from the `finish()` call will be lost.
Good catch. Adopted your suggestion with a few changes:
- The catch for IOException during finish() needs to rethrow the exception
- The catch for IOException during close() needs to check that finishException != ioe, otherwise addSuppressed may throw IAE, see https://bugs.openjdk.org/browse/JDK-8042377
- I renamed finishFailure to finishException
The above changes were inspired by the overridden method `FilterOutputStream.close()`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17209#discussion_r1439265718
More information about the core-libs-dev
mailing list