You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2023/12/19 10:31:54 UTC

(camel) branch camel-3.22.x updated: Fix try-with-resources for Java 8

This is an automated email from the ASF dual-hosted git repository.

gzurowski pushed a commit to branch camel-3.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.22.x by this push:
     new 8803f11b309 Fix try-with-resources for Java 8
8803f11b309 is described below

commit 8803f11b30953da9bf46387e9fd98afa072fa06e
Author: Gregor Zurowski <gr...@zurowski.org>
AuthorDate: Tue Dec 19 11:31:37 2023 +0100

    Fix try-with-resources for Java 8
---
 .../java/org/apache/camel/support/jsse/KeyStoreParameters.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
index 00476901949..e987920a482 100644
--- a/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
+++ b/core/camel-api/src/main/java/org/apache/camel/support/jsse/KeyStoreParameters.java
@@ -189,14 +189,14 @@ public class KeyStoreParameters extends JsseParameters {
         if (this.resource == null) {
             ks.load(null, ksPassword);
         } else {
-            InputStream is = this.resolveResource(this.parsePropertyValue(this.resource));
-            if (is == null) {
-                LOG.warn("No keystore could be found at {}.", this.resource);
-            } else {
-                try (is) {
+            try (InputStream is = this.resolveResource(this.parsePropertyValue(this.resource))) {
+                if (is == null) {
+                    LOG.warn("No keystore could be found at {}.", this.resource);
+                } else {
                     ks.load(is, ksPassword);
                 }
             }
+            ;
         }
 
         if (LOG.isDebugEnabled()) {