RFR: 8374819: Some I/O streams left unclosed
Johannes Döbler
duke at openjdk.org
Thu Jan 8 19:43:29 UTC 2026
On Mon, 29 Dec 2025 23:29:11 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:
> - 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.
src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java line 167:
> 165: try {
> 166: final Document doc = XmlUtils.initDocumentBuilder().parse(
> 167: new ByteArrayInputStream(Files.readAllBytes(appImageFilePath)));
would `.parse(appImageFilePath.toFile())` also work?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29007#discussion_r2673644925
More information about the core-libs-dev
mailing list