-
Notifications
You must be signed in to change notification settings - Fork 26.6k
fix: resolve resource leaks using try-with-resources #15874
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
base: 3.3
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #15874 +/- ##
=========================================
Coverage 60.75% 60.76%
+ Complexity 11757 11755 -2
=========================================
Files 1952 1952
Lines 89012 89002 -10
Branches 13421 13421
=========================================
+ Hits 54079 54080 +1
+ Misses 29367 29349 -18
- Partials 5566 5573 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
...o-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java
Outdated
Show resolved
Hide resolved
Update Bzip2.compress() and Bytes.zip() to follow PMC requirements
b410dfe to
936ea58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses resource-leak risks by converting manual stream/writer management to Java try-with-resources across a few utility and protocol components.
Changes:
- Update Triple Bzip2 compressor/decompressor to use try-with-resources for stream handling.
- Update Dubbo certificate PEM generation to use try-with-resources for writer handling.
- Update common IO and byte utilities to use try-with-resources for reader/stream handling.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/compressor/Bzip2.java | Ensures BZip2 streams are reliably closed during compress/decompress. |
| dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java | Switches PEM writer lifecycle to try-with-resources to avoid leaks. |
| dubbo-common/src/main/java/org/apache/dubbo/common/utils/IOUtils.java | Uses try-with-resources for InputStreamReader in read(InputStream, String). |
| dubbo-common/src/main/java/org/apache/dubbo/common/io/Bytes.java | Uses try-with-resources for deflate/inflate streams to ensure cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dubbo-plugin/dubbo-security/src/main/java/org/apache/dubbo/security/cert/DubboCertManager.java
Outdated
Show resolved
Hide resolved
zrlw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What is the purpose of the change?
fix: resolve resource leaks using try-with-resources #15742