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