Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create delegate on InflaterInputStream and DeflaterOutputStream #5744

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

ZongoForSpeed
Copy link

Those delegate are here to be sure the Inflater and Deflater resources are correctly released

@jansupol
Copy link
Contributor

Please see our wiki about missing ECA.

@jansupol
Copy link
Contributor

The behaviour is the same in JDK 8, the Deflater and Inflater are not called there, either.

* @see java.util.zip.Deflater
* @see java.util.zip.DeflaterOutputStream
*/
public final class ClosingDeflaterOutputStream extends OutputStream {
Copy link
Contributor

@jansupol jansupol Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to make those classes package-private private.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't make this class package-private and keep it in the internal package.
Do you want me to move those classes in the package 'org.glassfish.jersey.message' or to create inner classes ?

@ZongoForSpeed
Copy link
Author

@jansupol in JDK 8, the finalizer of Deflater & Inflater contains a call the end() method that will release correctly the Deflater/Inflater.
You in the source code of the Deflater/Inflater :
in Deflater.java (JDK 9)
@Deprecated(since="9", forRemoval=true) protected void finalize() {}
in Deflater.java (JDK 8)
/** * Closes the compressor when garbage is collected. */ protected void finalize() { end(); }

…ll end on Inflater and Deflater

Signed-off-by: Tanguy Lambert <tanguy.lambert@gmail.com>

Add missing import

Add missing Copyright comments

Signed-off-by: Tanguy LAMBERT <tanguy.lambert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants