summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:04:50 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:04:50 +0100
commit55164c43b9cd7989cbf20573efa8982641944b8c (patch)
tree253de6aac31da6bc9691f74dc8d955c50524d998
parent238f1693f7eab78505d469ae6349b262aa58eade (diff)
parent3212c8fa387995cecbb95de50508ba142f772203 (diff)
downloadjgit-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.java5
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()) {