[improve][io] Use try-with-resources for some locations - #24900
Merged
Conversation
lhotari
reviewed
Oct 28, 2025
lhotari
left a comment
Member
There was a problem hiding this comment.
There's no actual resource leaks in these cases. The unclosed resources are memory-only and there's no actual effect in making the changes in this PR. However, it's not a harmful change either.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #24900 +/- ##
============================================
- Coverage 74.31% 74.30% -0.01%
- Complexity 33843 33851 +8
============================================
Files 1913 1913
Lines 149325 149322 -3
Branches 17332 17332
============================================
- Hits 110966 110952 -14
- Misses 29503 29519 +16
+ Partials 8856 8851 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
lhotari
approved these changes
Oct 28, 2025
2 tasks
guptas6est
pushed a commit
to Nordix/pulsar
that referenced
this pull request
Oct 30, 2025
Co-authored-by: xcx <xcx@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24899
Motivation
use try-with stmt to close the resoure in:
1、org.apache.pulsar.io.flume.source.AbstractSource#process ObjectOutput
2、org.apache.pulsar.io.file.utils.GZipFiles#isGzip PushbackInputStream
Modifications
Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: