aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:06:16 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:06:16 +0100
commitb118e7b4c4f71181668e003b83f20f84e3b2257e (patch)
tree76cfb99f68aad7f2cdf840179c9b2f8dc284b568 /org.eclipse.jgit/src/org/eclipse/jgit
parentebad3881b73cdfc1c07e06129d0023fd8f28d97e (diff)
parent5b16c8ae155ad59856102b42ada395917eaed888 (diff)
downloadjgit-b118e7b4c4f71181668e003b83f20f84e3b2257e.tar.gz
jgit-b118e7b4c4f71181668e003b83f20f84e3b2257e.zip
Merge branch 'stable-6.1' into stable-6.2
* stable-6.1: GC: Close File.lines stream Change-Id: Ia2be0b05ed860125a388b01d6c291832f08dd990
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-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()) {