summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Puzikov <d.puzikov2@partner.samsung.com>2019-11-28 14:33:24 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-12-05 12:26:30 +0000
commit1cbcf8ee77b394cd0f4e896197e24f09acef5861 (patch)
tree09d017e2f4398dd1b222524790856f1370320a09
parentfb6e60d0e430e81c1ff2c03134d0ec2e57f69400 (diff)
Logged all caught exceptions
Fix sonar issue related to logging caught exceptions. Change-Id: I61b2106165a81f3b2f0f9cc0da5911787504f50e Issue-ID: SDC-2698 Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com>
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java35
1 files changed, 30 insertions, 5 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
index 9a3fbd26fb..d13d5f7b92 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
@@ -39,9 +39,13 @@ import org.onap.config.Constants;
import org.onap.config.NonConfigResource;
import org.onap.config.api.Config;
import org.onap.config.api.Hint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ConfigurationImpl implements org.onap.config.api.Configuration {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationImpl.class);
+
private static final String KEY_CANNOT_BE_NULL = "Key can't be null.";
private static final NonConfigResource NON_CONFIG_RESOURCE = new NonConfigResource();
@@ -51,7 +55,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
try {
init();
} catch (ConfigurationException e) {
- throw new IllegalStateException("Failed to initialize configuration");
+ throw new IllegalStateException("Failed to initialize configuration", e);
}
}
@@ -214,7 +218,14 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
}
}
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.warn(
+ "Couldn't populate map fot tenant: {}, namespace: {}, key: {}, type: {}",
+ tenantId,
+ namespace,
+ key,
+ clazz.getSimpleName(),
+ e
+ );
}
return map;
}
@@ -262,7 +273,13 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
map.put(k, value);
}
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.warn(
+ "Couldn't generate map fot tenant: {}, namespace: {}, key: {}",
+ tenantId,
+ namespace,
+ key,
+ e
+ );
}
return parentMap;
}
@@ -336,7 +353,14 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
+ "class decorated with @org.openecomp.config.api.Config are allowed as argument.");
}
} catch (Exception exception) {
- exception.printStackTrace();
+ LOGGER.warn(
+ "Failed to get internal value fot tenant: {}, namespace: {}, key: {}, type: {}",
+ tenant,
+ namespace,
+ key,
+ clazz.getSimpleName(),
+ exception
+ );
}
return null;
}
@@ -422,6 +446,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
try {
return clazz.getDeclaredConstructor(classes);
} catch (Exception exception) {
+ LOGGER.warn("Failed to get {} constructor.", clazz.getSimpleName(), exception);
return null;
}
}
@@ -546,7 +571,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
collection.add(type1);
}
} catch (RuntimeException re) {
- // do nothing
+ LOGGER.warn("Failed to convert {}", commaSeparatedValues, re);
}
}
return collection;