Fallback to default key manager reloading conf if can't read ssl-client
@@ -302,6 +302,7 @@ private SSLContext initializeSSLContext() throws IOException {
String timeUnitStr = FileBasedKeyStoresFactory.DEFAULT_SSL_KEYSTORE_RELOAD_TIMEUNIT;
long trustStoreReloadInterval = FileBasedKeyStoresFactory.DEFAULT_SSL_TRUSTSTORE_RELOAD_INTERVAL;
if (sslClientConf != null) {
+ try {
keyStoreReloadInterval = sslClientConf.getLong(FileBasedKeyStoresFactory.resolvePropertyName(
SSLFactory.Mode.CLIENT, FileBasedKeyStoresFactory.SSL_KEYSTORE_RELOAD_INTERVAL_TPL_KEY),
FileBasedKeyStoresFactory.DEFAULT_SSL_KEYSTORE_RELOAD_INTERVAL);
@@ -311,6 +312,11 @@ private SSLContext initializeSSLContext() throws IOException {
trustStoreReloadInterval = sslClientConf.getLong(FileBasedKeyStoresFactory.resolvePropertyName(
SSLFactory.Mode.CLIENT, FileBasedKeyStoresFactory.SSL_TRUSTSTORE_RELOAD_INTERVAL_TPL_KEY),
FileBasedKeyStoresFactory.DEFAULT_SSL_TRUSTSTORE_RELOAD_INTERVAL);
+ } catch (RuntimeException ex) {
+ // RuntimeException will be thrown if configuration file exists but we can't read it
+ // In that case just fall back to default values
+ LOG.warn("ssl-client.xml exists but we can't read it, falling back to default configuration");
+ }
}
TimeUnit timeUnit = TimeUnit.valueOf(timeUnitStr);
sslCtx.init(createKeyManagers(keyStoreReloadInterval, timeUnit), createTrustManagers(trustStoreReloadInterval),
