RFR: 8374819: Some I/O streams left unclosed [v2]

Alexey Semenyuk asemenyuk at openjdk.org
Fri Jan 9 03:21:12 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.

Alexey Semenyuk has updated the pull request incrementally with three additional commits since the last revision:

 - AppImageInfoPListFile: simplify
 - Remove redundant "throws javax.xml.parsers.ParserConfigurationException" from PListReader#PListReader(byte[]) signature
 - AppImageFile: add a comment explaining why we use javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) and not javax.xml.parsers.DocumentBuilder#parse(java.io.File), even the later is more suitable for reading XML from a file

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/29007/files
  - new: https://git.openjdk.org/jdk/pull/29007/files/07daf20f..eb36bbfe

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29007&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29007&range=00-01

  Stats: 25 lines in 4 files changed: 15 ins; 6 del; 4 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