RFR: 8374819: Some I/O streams left unclosed
Alexey Semenyuk
asemenyuk at openjdk.org
Thu Jan 8 18:52:38 UTC 2026
- Replace `Files.newInputStream(path)` in chain method calls with either `new ByteArrayInputStream(Files.readAllBytes(path))` or `path.toFile()` if there is an alternative method taking a `File` instance instead of an `InputStream` and if appropriate.
- Add missing try-with-resources for `Class.getResourceAsStream()` calls.
-------------
Commit messages:
- Close opened streams or replace DocumentBuilder.parse(InputStream) with DocumentBuilder.parse(File) whichever suits better.
Changes: https://git.openjdk.org/jdk/pull/29007/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29007&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8374819
Stats: 25 lines in 6 files changed: 7 ins; 4 del; 14 mod
Patch: https://git.openjdk.org/jdk/pull/29007.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29007/head:pull/29007
PR: https://git.openjdk.org/jdk/pull/29007
More information about the core-libs-dev
mailing list