Merge branch 'stable-5.13' into stable-6.0

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

Change-Id: Ib473750e5a3ad3d74b0cb41f25052890f50a975c
This commit is contained in:
Matthias Sohn 2023-03-23 09:04:50 +01:00
commit 55164c43b9
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()) {