This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch camel-3.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.20.x by this push:
new 20be5bf2fcc CAMEL-19840: camel-core-api - Warn when the key store
cannot be found (#11313)
20be5bf2fcc is described below
commit 20be5bf2fcc45299bae638920598677f10dadb08
Author: Nicolas Filotto <[email protected]>
AuthorDate: Wed Sep 6 13:36:19 2023 +0200
CAMEL-19840: camel-core-api - Warn when the key store cannot be found
(#11313)
## 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 971ac55183e..b6ff5c36f48 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()) {