From f9b702bbe6cc958b16aaaf983cdd4d6d93b818fd Mon Sep 17 00:00:00 2001 From: Dmitry Puzikov Date: Wed, 13 Nov 2019 16:52:25 +0100 Subject: Fixing sonar issues Added logging instead of skipping or printing stacktraces. Change-Id: I258a2a76c295f12b30e200c4519bc1bb0741f642 Issue-ID: SDC-2654 Signed-off-by: Dmitry Puzikov --- .../src/main/java/org/onap/config/ConfigurationUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'common') 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; } -- cgit 1.2.3-korg