From 9405a1e62aa6d46d4e94f26d5496319e0ee68a6a Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Fri, 27 Oct 2023 16:40:40 +0100 Subject: Fix exception in healthcheck with http Signed-off-by: MichaelMorris Issue-ID: SDC-4674 Change-Id: I49e053c17018eb1bd824b4eb120c27b99266e521 --- .../sdc/fe/impl/HealthCheckScheduledTask.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HealthCheckScheduledTask.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HealthCheckScheduledTask.java index 0db9fe9a44..c7c0e9e4e6 100644 --- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HealthCheckScheduledTask.java +++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/HealthCheckScheduledTask.java @@ -147,11 +147,22 @@ public class HealthCheckScheduledTask implements Runnable { private ClientCertificate getHttpClientCertificate() { ClientCertificate clientCertificate = new ClientCertificate(); - clientCertificate.setKeyStore(JettySSLUtils.getSSLConfig().getKeystorePath()); - clientCertificate.setKeyStorePassword(JettySSLUtils.getSSLConfig().getKeystorePass(), false); - clientCertificate.setTrustStore(JettySSLUtils.getSSLConfig().getTruststorePath()); - clientCertificate.setTrustStorePassword(JettySSLUtils.getSSLConfig().getTruststorePass()); - return clientCertificate; + boolean certificateInfoConfigured = false; + if (StringUtils.isNotBlank(JettySSLUtils.getSSLConfig().getKeystorePath())) { + clientCertificate.setKeyStore(JettySSLUtils.getSSLConfig().getKeystorePath()); + if (StringUtils.isNotBlank(JettySSLUtils.getSSLConfig().getKeystorePass())) { + clientCertificate.setKeyStorePassword(JettySSLUtils.getSSLConfig().getKeystorePass(), false); + } + certificateInfoConfigured = true; + } + if (StringUtils.isNotBlank(JettySSLUtils.getSSLConfig().getTruststorePath())) { + clientCertificate.setTrustStore(JettySSLUtils.getSSLConfig().getTruststorePath()); + if (StringUtils.isNotBlank(JettySSLUtils.getSSLConfig().getTruststorePass())) { + clientCertificate.setTrustStorePassword(JettySSLUtils.getSSLConfig().getTruststorePass()); + } + certificateInfoConfigured = true; + } + return certificateInfoConfigured ? clientCertificate: null; } private String getExternalComponentHcUri(String baseComponent) { -- cgit 1.2.3-korg