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