Skip to content

fix(io): close all streams in ListOutputStream#close#2392

Open
iamsanjaymalakar wants to merge 1 commit intoappium:masterfrom
iamsanjaymalakar:master
Open

fix(io): close all streams in ListOutputStream#close#2392
iamsanjaymalakar wants to merge 1 commit intoappium:masterfrom
iamsanjaymalakar:master

Conversation

@iamsanjaymalakar
Copy link

Change list

  • Make ListOutputStream.close() close all underlying OutputStreams even if one close() throws.
  • Collect the first IOException and attach subsequent close failures as suppressed exceptions, then rethrow after attempting all closes.

Types of changes

  • No changes in production code.
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Details

ListOutputStream.close() previously stopped at the first IOException, which could leave remaining streams unclosed and potentially leak resources. The updated implementation attempts to close every stream and only throws after cleanup is complete (preserving additional failures via suppressed exceptions).

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 9, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: iamsanjaymalakar / name: Sanjay Malakar (c75eda7)

@iamsanjaymalakar iamsanjaymalakar changed the title Fix ListOutputStream.close() to close all streams on failure fix(io): close all streams in ListOutputStream#close Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant