diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:06:43 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:06:43 +0100 |
commit | 137efda0baafa639e73d31a07f3892ebf1a4b868 (patch) | |
tree | 2e98bc637ae9ff1ae95ae39406851a543db02980 | |
parent | 9dd912a1c2f288bfc27b2753a017277067801548 (diff) | |
parent | b118e7b4c4f71181668e003b83f20f84e3b2257e (diff) | |
download | jgit-137efda0baafa639e73d31a07f3892ebf1a4b868.tar.gz jgit-137efda0baafa639e73d31a07f3892ebf1a4b868.zip |
Merge branch 'stable-6.2' into stable-6.3
* stable-6.2:
GC: Close File.lines stream
Change-Id: Id93b1933a5ce1ede9eb388c9fd54a4b3749694bf
-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()) { |