diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:04:50 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-03-23 09:04:50 +0100 |
commit | 55164c43b9cd7989cbf20573efa8982641944b8c (patch) | |
tree | 253de6aac31da6bc9691f74dc8d955c50524d998 | |
parent | 238f1693f7eab78505d469ae6349b262aa58eade (diff) | |
parent | 3212c8fa387995cecbb95de50508ba142f772203 (diff) | |
download | jgit-55164c43b9cd7989cbf20573efa8982641944b8c.tar.gz jgit-55164c43b9cd7989cbf20573efa8982641944b8c.zip |
Merge branch 'stable-5.13' into stable-6.0
* stable-5.13:
GC: Close File.lines stream
Change-Id: Ib473750e5a3ad3d74b0cb41f25052890f50a975c
-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()) { |