fix(io): close all streams in ListOutputStream#close by iamsanjaymalakar · Pull Request #2392 · appium/java-client
Change list
- Make
ListOutputStream.close()close all underlyingOutputStreams even if oneclose()throws. - Collect the first
IOExceptionand 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).