From b7375b2488df93ba9df57ad13ec628bbff663819 Mon Sep 17 00:00:00 2001 From: vempo Date: Thu, 7 Sep 2017 10:52:29 +0300 Subject: Fixed a few static analysis violations Fixed mostly not closing resources (InputStream, ResultSet) and catching Throwable instead of Exception in some modules. Issue-ID: SDC-291 Change-Id: I34e331cc3b45c4bb3a71c301f50e1706a7b623fd Signed-off-by: vempo --- .../src/main/java/org/openecomp/core/logging/api/LoggerFactory.java | 4 ++-- .../main/java/org/openecomp/core/logging/api/context/TaskFactory.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'common/openecomp-logging-lib/openecomp-logging-api/src/main/java') diff --git a/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/LoggerFactory.java b/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/LoggerFactory.java index e6f4aa3707..fdc874ee54 100644 --- a/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/LoggerFactory.java +++ b/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/LoggerFactory.java @@ -41,8 +41,8 @@ public class LoggerFactory extends BaseFactory { try { service = locateService(LoggerCreationService.class); - } catch (Throwable throwable) { - new RuntimeException("Failed to instantiate logger factory", throwable).printStackTrace(); + } catch (Exception e) { + new RuntimeException("Failed to instantiate logger factory", e).printStackTrace(); // use the no-op service to prevent recursion in case of an attempt to log an exception as a // result of a logger initialization error service = new NoOpLoggerCreationService(); diff --git a/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/context/TaskFactory.java b/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/context/TaskFactory.java index b358a77573..30bc7372c6 100644 --- a/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/context/TaskFactory.java +++ b/common/openecomp-logging-lib/openecomp-logging-api/src/main/java/org/openecomp/core/logging/api/context/TaskFactory.java @@ -46,8 +46,8 @@ public class TaskFactory extends BaseFactory { try { service = locateService(ContextPropagationService.class); - } catch (Throwable throwable) { - error = new RuntimeException("Failed to instantiate task factory", throwable); + } catch (Exception e) { + error = new RuntimeException("Failed to instantiate task factory", e); } SERVICE = service; -- cgit 1.2.3-korg