Skip to content

[improve][io] Use try-with-resources for some locations - #24900

Merged
lhotari merged 1 commit into
apache:masterfrom
AROP-REPLICATION:rl
Oct 28, 2025
Merged

[improve][io] Use try-with-resources for some locations#24900
lhotari merged 1 commit into
apache:masterfrom
AROP-REPLICATION:rl

Conversation

@AROP-REPLICATION

Copy link
Copy Markdown
Contributor

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

  • Make sure that the change passes the CI checks.

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Oct 28, 2025
@lhotari lhotari changed the title fix some resource leaks [fix][io] fix some resource leaks Oct 28, 2025
@lhotari lhotari added this to the 4.2.0 milestone Oct 28, 2025

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@lhotari lhotari changed the title [fix][io] fix some resource leaks [improve][io] Use try-with-resources for some locations Oct 28, 2025
@codecov-commenter

codecov-commenter commented Oct 28, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.30%. Comparing base (ebfff58) to head (072b85d).
⚠️ Report is 349 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
inttests 26.41% <ø> (+0.06%) ⬆️
systests 22.81% <0.00%> (-0.11%) ⬇️
unittests 73.82% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...ava/org/apache/pulsar/io/file/utils/GZipFiles.java 68.18% <100.00%> (ø)
.../apache/pulsar/io/flume/source/AbstractSource.java 83.33% <100.00%> (-0.99%) ⬇️

... and 68 files with indirect coverage changes

🚀 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.

@lhotari
lhotari merged commit d275748 into apache:master Oct 28, 2025
55 of 57 checks passed
@lhotari lhotari mentioned this pull request Oct 29, 2025
2 tasks
guptas6est pushed a commit to Nordix/pulsar that referenced this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants