Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  GC: Close File.lines stream

Change-Id: Id93b1933a5ce1ede9eb388c9fd54a4b3749694bf
This commit is contained in:
Matthias Sohn 2023-03-23 09:06:43 +01:00
commit 137efda0ba
1 changed files with 3 additions and 2 deletions

View File

@ -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()) {