aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:05:42 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-03-23 09:05:42 +0100
commit5b16c8ae155ad59856102b42ada395917eaed888 (patch)
tree21665337d0da239a00a66036d9ac2d2c67c3631e /org.eclipse.jgit
parenta4ca500d26f64cbef6280c449cab859577179ea1 (diff)
parent55164c43b9cd7989cbf20573efa8982641944b8c (diff)
downloadjgit-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.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()) {