| commit | b118e7b4c4f71181668e003b83f20f84e3b2257e | [log] [tgz] |
|---|---|---|
| author | Matthias Sohn <matthias.sohn@sap.com> | Thu Mar 23 09:06:16 2023 +0100 |
| committer | Matthias Sohn <matthias.sohn@sap.com> | Thu Mar 23 09:06:16 2023 +0100 |
| tree | 76cfb99f68aad7f2cdf840179c9b2f8dc284b568 | |
| parent | ebad3881b73cdfc1c07e06129d0023fd8f28d97e [diff] | |
| parent | 5b16c8ae155ad59856102b42ada395917eaed888 [diff] |
Merge branch 'stable-6.1' into stable-6.2 * stable-6.1: GC: Close File.lines stream Change-Id: Ia2be0b05ed860125a388b01d6c291832f08dd990
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 de01168..fef8a35 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 @@ private void failedToLock() { 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()) {