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


The following commit(s) were added to refs/heads/main by this push:
     new 10ff57749db0 Fix OpenScanHub 4.14.2 findings
10ff57749db0 is described below

commit 10ff57749db09b8d20b06e46200100c35878f801
Author: Roman Stepaniuk <[email protected]>
AuthorDate: Tue Dec 2 17:35:56 2025 +0100

    Fix OpenScanHub 4.14.2 findings
---
 .../java/org/apache/camel/maven/GenerateMojo.java  | 23 ++++++++--------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git 
a/catalog/camel-csimple-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
 
b/catalog/camel-csimple-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
index b28915aed4e1..83a18cbd8f97 100644
--- 
a/catalog/camel-csimple-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
+++ 
b/catalog/camel-csimple-maven-plugin/src/main/java/org/apache/camel/maven/GenerateMojo.java
@@ -289,24 +289,17 @@ public class GenerateMojo extends AbstractExecMojo {
     }
 
     private static String load(String configFile) {
-        String loaded;
-        InputStream is = null;
-        try {
-            // load from file system
-            File file = new File(configFile);
-            if (file.exists()) {
-                is = new FileInputStream(file);
-            }
-            if (is == null) {
-                return null;
-            }
-            loaded = IOHelper.loadText(is);
+        // load from file system
+        File file = new File(configFile);
+        if (!file.exists()) {
+            return null;
+        }
+
+        try (InputStream is = new FileInputStream(file)) {
+            return IOHelper.loadText(is);
         } catch (IOException e) {
             throw new RuntimeCamelException("Cannot load " + configFile);
-
         }
-        IOHelper.close(is);
-        return loaded;
     }
 
     private boolean matchRouteFile(File file) {

Reply via email to