Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@heliang666s
Copy link
Member

What is the purpose of the change?

fix: resolve resource leaks using try-with-resources #15742

@codecov-commenter
Copy link

codecov-commenter commented Dec 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.76%. Comparing base (f5d6436) to head (d086d59).

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     
Flag Coverage Δ
integration-tests-java21 32.24% <0.00%> (+0.06%) ⬆️
integration-tests-java8 32.32% <0.00%> (-0.02%) ⬇️
samples-tests-java21 32.09% <0.00%> (-0.03%) ⬇️
samples-tests-java8 29.73% <0.00%> (+0.01%) ⬆️
unit-tests-java11 59.02% <77.77%> (+<0.01%) ⬆️
unit-tests-java17 58.52% <100.00%> (+<0.01%) ⬆️
unit-tests-java21 58.51% <100.00%> (-0.01%) ⬇️
unit-tests-java25 58.47% <100.00%> (-0.01%) ⬇️
unit-tests-java8 59.00% <77.77%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

RainYuY
RainYuY previously approved these changes Dec 16, 2025
Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

@zrlw zrlw left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants