JDK-8066583 : DeflaterInput/OutputStream and InflaterInput/OutputStream should explain responsibility for freeing resources
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-12-03
  • Updated: 2025-04-14
  • Resolved: 2025-04-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b18Fixed
Related Reports
CSR :  
Relates :  
Description
java.util.zip.DeflaterOutputStream will only call Deflater#end() if it uses a default Deflater instance (i.e. one it created itself). This means that users of the DeflaterOutputStream constructors taking a Deflater parameter have to call Deflater#end() explicitly if they want resources to be freed before garbage collection. 

While this makes sense it should be mentioned in the JavaDoc for DeflaterOutputStream, probably in the documentation for the constructors taking a Deflater parameter.
Comments
Changeset: 9844c1c5 Branch: master Author: Jaikiran Pai <jpai@openjdk.org> Date: 2025-04-08 06:07:44 +0000 URL: https://git.openjdk.org/jdk/commit/9844c1c52b9b7b6959d4e5cc626495c83f4aa9d4
08-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23655 Date: 2025-02-16 11:44:23 +0000
16-02-2025