RFR: 8349909: jdk.internal.jimage.decompressor.ZipDecompressor does not close the Inflater in exceptional cases

Alan Bateman alanb at openjdk.org
Mon Feb 17 10:52:09 UTC 2025


On Fri, 14 Feb 2025 07:41:26 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which proposes to properly close the `Inflater` instance used in `jdk.internal.jimage.decompressor.ZipDecompressor.decompress()` method? This addresses https://bugs.openjdk.org/browse/JDK-8349909.
> 
> As noted in that issue, in the exceptional case in the `decompress()` method, the `Inflater` instance isn't currently being closed. The commit in this PR uses a try/finally block to `end()` the `Inflater` instance.
> 
> Unlike some other places within the JDK, the code in `jdk.internal.jimage.decompressor.ZipDecompressor` is expected to maintain Java 8 (API) compatibility, so this part of the code cannot use the newly introduced `Inflater.close()` method and thus cannot use the try-with-resources statement too.
> 
> No new tests have been added given the nature of this change. A noreg label has been added to the JBS issue. Existing tests in tier1, tier2 and tier3 continue to pass with this change.

Looks fine although I assume we've never had any reports of an exception here.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23626#pullrequestreview-2620700726


More information about the core-libs-dev mailing list