RFR: 2323: Use stream-bearing methods of java.nio.file.Files correctly

Pavel Rappo prappo at openjdk.org
Wed Jul 10 08:51:50 UTC 2024


Streams returned from methods of `java.nio.file.Files` should be closed. A typical documentation note reads as follows:

> This method must be used within a try-with-resources statement or similar control structure to ensure that the stream's <resource> is closed promptly after the stream's operations have completed.

In a few occasions, code was additionally lightly simplified:

  - LinkTask.java#L131
  - LinkTask.java#L179
  - VersionPlugin.java#L55-L60

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

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/skara/pull/1675/files
  Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1675&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-2323
  Stats: 159 lines in 20 files changed: 26 ins; 7 del; 126 mod
  Patch: https://git.openjdk.org/skara/pull/1675.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1675/head:pull/1675

PR: https://git.openjdk.org/skara/pull/1675


More information about the skara-dev mailing list