Merge branch 'stable-6.0' into stable-6.1

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

Change-Id: I2f9e6da5584a40bb4b4efed0b87ae456f119d757
This commit is contained in:
Matthias Sohn 2023-03-23 09:05:42 +01:00
commit 5b16c8ae15
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()) {