From: Dmitry Puzikov Date: Wed, 13 Nov 2019 15:52:25 +0000 (+0100) Subject: Fixing sonar issues X-Git-Tag: 1.6.1~68 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F98375%2F3;p=sdc.git Fixing sonar issues Added logging instead of skipping or printing stacktraces. Change-Id: I258a2a76c295f12b30e200c4519bc1bb0741f642 Issue-ID: SDC-2654 Signed-off-by: Dmitry Puzikov --- diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java index 991ec5fc8b..6adeb2db10 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java @@ -205,7 +205,7 @@ public class ConfigurationUtils { try { return Enum.valueOf(ConfigurationMode.class, modeName); } catch (Exception exception) { - //do nothing + LOGGER.debug("Configuration mode for merge strategy '{}' not found", modeName, exception); } } } @@ -231,7 +231,7 @@ public class ConfigurationUtils { throw new ConfigurationException(CONFIGURATION_TYPE_NOT_SUPPORTED + configType); } } catch (ConfigurationException exception) { - exception.printStackTrace(); + LOGGER.error("Error reading configuration at {}.", url.toString(), exception); } return Optional.empty(); @@ -263,7 +263,7 @@ public class ConfigurationUtils { try { configurationMode = ConfigurationMode.valueOf(configMode); } catch (Exception exception) { - LOGGER.error("Could not find convert {} into configuration mode", configMode); + LOGGER.error("Could not find convert {} into configuration mode.", configMode, exception); } return Optional.ofNullable(configurationMode); } @@ -457,7 +457,7 @@ public class ConfigurationUtils { return IOUtils.toString(new URL(path), Charset.defaultCharset()); } } catch (Exception exception) { - exception.printStackTrace(); + LOGGER.error("Error while getting '{}' content", path, exception); } return null; } @@ -468,7 +468,7 @@ public class ConfigurationUtils { return new String(Files.readAllBytes(path)); } } catch (Exception exception) { - exception.printStackTrace(); + LOGGER.error("Error while getting '{}' content", path.toString(), exception); } return null; }