You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/09/06 11:37:15 UTC

[camel] branch camel-3.x updated: CAMEL-19840: camel-core-api - Warn when the key store cannot be found (#11317)

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

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


The following commit(s) were added to refs/heads/camel-3.x by this push:
     new a4c5c22b3a6 CAMEL-19840: camel-core-api - Warn when the key store cannot be found (#11317)
a4c5c22b3a6 is described below

commit a4c5c22b3a630a5d080d293db02655962d6732ca
Author: Nicolas Filotto <es...@users.noreply.github.com>
AuthorDate: Wed Sep 6 13:37:08 2023 +0200

    CAMEL-19840: camel-core-api - Warn when the key store cannot be found (#11317)
    
    ## Motivation
    
    If `KeyStoreParameters` are configured with an incorrect path for the key store file, at runtime, we end up with an error that can be more or less easy to understand depending on the underlying component for which SSL has been configured.
    
    ## Modifications:
    
    * Add a warning when the key store file cannot be found
---
 .../java/org/apache/camel/support/jsse/KeyStoreParameters.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 ea063819de7..00476901949 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
@@ -190,7 +190,13 @@ public class KeyStoreParameters extends JsseParameters {
             ks.load(null, ksPassword);
         } else {
             InputStream is = this.resolveResource(this.parsePropertyValue(this.resource));
-            ks.load(is, ksPassword);
+            if (is == null) {
+                LOG.warn("No keystore could be found at {}.", this.resource);
+            } else {
+                try (is) {
+                    ks.load(is, ksPassword);
+                }
+            }
         }
 
         if (LOG.isDebugEnabled()) {