From b2925aafd63f031392a4a5d44e105d047af7eed2 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Thu, 8 Nov 2018 16:29:04 -0600 Subject: Improve nonContainer Agent Config Issue-ID: AAF-619 Change-Id: I9ea4a5a7fb1d5006d50ffc70f0bc0f98812d1513 Signed-off-by: Instrumental --- cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java | 4 ++++ .../src/main/java/org/onap/aaf/cadi/config/Config.java | 2 +- .../main/java/org/onap/aaf/cadi/config/SecurityInfo.java | 14 +++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'cadi/core') diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java index 8467c7c6..97984b03 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java @@ -398,4 +398,8 @@ public class PropAccess implements Access { public void set(LogIt logit) { logIt = logit; } + + public String toString() { + return props.toString(); + } } diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java index 2f9de6cf..3d668c42 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/Config.java @@ -774,7 +774,7 @@ public class Config { Method meth = lcls.getMethod("create",String.class); locator = (Locator)meth.invoke(null,url); } catch (Exception e) { - access.log(Level.INIT, e); + access.log(Level.DEBUG, "(Not fatal) Cannot load by create(String)", e); } if (locator==null) { URI locatorURI = new URI(url); diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java index bb9981bf..e3eb34be 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/config/SecurityInfo.java @@ -152,7 +152,9 @@ public class SecurityInfo { protected void initializeKeyManager() throws CadiException, IOException, NoSuchAlgorithmException, KeyStoreException, CertificateException, UnrecoverableKeyException { String keyStore = access.getProperty(Config.CADI_KEYSTORE, null); - if (keyStore != null && !new File(keyStore).exists()) { + if(keyStore==null) { + return; + } else if (!new File(keyStore).exists()) { throw new CadiException(keyStore + " does not exist"); } @@ -201,16 +203,14 @@ public class SecurityInfo { protected void initializeTrustManager() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException, CadiException { String trustStore = access.getProperty(Config.CADI_TRUSTSTORE, null); - if (trustStore != null && !new File(trustStore).exists()) { + if(trustStore==null) { + return; + } else if(!new File(trustStore).exists()) { throw new CadiException(trustStore + " does not exist"); } - if (trustStore == null) { - return; - } - String trustStorePasswd = access.getProperty(Config.CADI_TRUSTSTORE_PASSWORD, null); - trustStorePasswd = (trustStorePasswd == null) ? "changeit"/*defacto Java Trust Pass*/ : access.decrypt(trustStorePasswd, false); + trustStorePasswd = (trustStorePasswd == null ) ? "changeit"/*defacto Java Trust Pass*/ : access.decrypt(trustStorePasswd, false); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(SSL_KEY_MANAGER_FACTORY_ALGORITHM); File file; -- cgit 1.2.3-korg