NIFI-11332 Close Stream from Files.lines in StandardRuntimeManifestService

This closes #7079

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Bryan Bende 2023-03-23 12:31:57 -04:00 committed by exceptionfactory
parent 1b84927ed5
commit 5386095083
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
1 changed files with 3 additions and 2 deletions

View File

@ -43,6 +43,7 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
public class StandardRuntimeManifestService implements RuntimeManifestService { public class StandardRuntimeManifestService implements RuntimeManifestService {
@ -149,9 +150,9 @@ public class StandardRuntimeManifestService implements RuntimeManifestService {
continue; continue;
} }
try { try (final Stream<String> additionalDetailsLines = Files.lines(additionalDetailsFile.toPath())) {
final String typeName = additionalDetailsTypeDir.getName(); final String typeName = additionalDetailsTypeDir.getName();
final String additionalDetailsContent = Files.lines(additionalDetailsFile.toPath()).collect(Collectors.joining()); final String additionalDetailsContent = additionalDetailsLines.collect(Collectors.joining());
LOGGER.debug("Added additionalDetails for {} from {}", typeName, additionalDetailsFile.getAbsolutePath()); LOGGER.debug("Added additionalDetails for {} from {}", typeName, additionalDetailsFile.getAbsolutePath());
additionalDetailsMap.put(typeName, additionalDetailsContent); additionalDetailsMap.put(typeName, additionalDetailsContent);
} catch (final IOException e) { } catch (final IOException e) {