diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:05:42 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:05:42 +0100 |
commit | 5b16c8ae155ad59856102b42ada395917eaed888 (patch) | |
tree | 21665337d0da239a00a66036d9ac2d2c67c3631e /org.eclipse.jgit | |
parent | a4ca500d26f64cbef6280c449cab859577179ea1 (diff) | |
parent | 55164c43b9cd7989cbf20573efa8982641944b8c (diff) | |
download | jgit-5b16c8ae155ad59856102b42ada395917eaed888.tar.gz jgit-5b16c8ae155ad59856102b42ada395917eaed888.zip |
Merge branch 'stable-6.0' into stable-6.1
* stable-6.0:
GC: Close File.lines stream
Change-Id: I2f9e6da5584a40bb4b4efed0b87ae456f119d757
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index de01168195..fef8a35d3d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -1683,8 +1683,9 @@ public class GC { private void gcAlreadyRunning() { close(); - try { - Optional<String> s = Files.lines(pidFile).findFirst(); + Optional<String> s; + try (Stream<String> lines = Files.lines(pidFile)) { + s = lines.findFirst(); String machine = null; String pid = null; if (s.isPresent()) { |