This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit aabab430e490be7dd8758f78853400eb62847aff Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue Mar 22 11:04:39 2022 +0100 (chores) camel-report-maven-plugin: use try-with-resources where possible Co-authored-by: Nicolas Filotto <[email protected]> --- .../main/java/org/apache/camel/maven/ValidateMojo.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/ValidateMojo.java b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/ValidateMojo.java index 963d40b..457ab41 100644 --- a/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/ValidateMojo.java +++ b/catalog/camel-report-maven-plugin/src/main/java/org/apache/camel/maven/ValidateMojo.java @@ -558,19 +558,19 @@ public class ValidateMojo extends AbstractExecMojo { String fqn = file.getPath(); String baseDir = "."; - InputStream is = new FileInputStream(file); - XmlRouteParser.parseXmlRouteEndpoints(is, baseDir, fqn, fileEndpoints); - is.close(); + try (InputStream is = new FileInputStream(file)) { + XmlRouteParser.parseXmlRouteEndpoints(is, baseDir, fqn, fileEndpoints); + } // need a new stream - is = new FileInputStream(file); - XmlRouteParser.parseXmlRouteSimpleExpressions(is, baseDir, fqn, fileSimpleExpressions); - is.close(); + try (InputStream is = new FileInputStream(file)) { + XmlRouteParser.parseXmlRouteSimpleExpressions(is, baseDir, fqn, fileSimpleExpressions); + } if (duplicateRouteId) { // need a new stream - is = new FileInputStream(file); - XmlRouteParser.parseXmlRouteRouteIds(is, baseDir, fqn, fileRouteIds); - is.close(); + try (InputStream is = new FileInputStream(file)) { + XmlRouteParser.parseXmlRouteRouteIds(is, baseDir, fqn, fileRouteIds); + } } // add what we found in this file to the total list
