diff options
author | Isaac Manuel Raj <isaac.manuelraj@huawei.com> | 2019-08-09 19:11:06 +0530 |
---|---|---|
committer | Isaac Manuel Raj <isaac.manuelraj@huawei.com> | 2019-08-09 19:11:06 +0530 |
commit | f4f2d4644aeabb56ccafa3e3e11af784d98979fa (patch) | |
tree | 2b2bbfaca451e98e1c4bc09b79009ff93c010c5c | |
parent | 0ca2b4ccdcdd3c7801ecb4a2fb12cfe31b936f9b (diff) |
Usecaseui server sonar critical issue fix.
Usecase ui code was not having logger to capture the exception trace. The same is fixed.
Issue-ID: USECASEUI-304
Signed-off-by: Isaac Manuel Raj <isaac.manuelraj@huawei.com>
Change-Id: I438700f44b5b8cd03014d885f14f43457db274f9
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java | 5 | ||||
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java index 59b55052..d1b41c27 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java @@ -24,6 +24,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; +import com.google.common.base.Throwables; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -249,7 +250,9 @@ public class DefaultServiceLcmService implements ServiceLcmService { session.saveOrUpdate(serviceOperation); session.flush(); } catch (Exception e) { - e.printStackTrace(); + logger.error( + "exception occurred while performing DefaultServiceLcmService saveOrUpdateServiceInstanceOperation. Details:" + + Throwables.getStackTraceAsString(e)); logger.error( "exception occurred while performing DefaultServiceLcmService saveOrUpdateServiceInstanceOperation. Details:" + e.getMessage()); diff --git a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java index 1d51e2e8..23c0fda4 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/DmaapSubscriber.java @@ -30,6 +30,7 @@ import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.Response; +import com.google.common.base.Throwables; import org.glassfish.jersey.client.ClientConfig; import org.onap.usecaseui.server.bean.*; import org.onap.usecaseui.server.constant.Constant; @@ -87,7 +88,9 @@ public class DmaapSubscriber implements Runnable { alarmProcess(eventMaps); } } catch (IOException e) { - e.printStackTrace(); + logger.error( + "exception occurred while performing DmaapSubcriber performanceProcess or alarmProcess. Details:{}", + Throwables.getStackTraceAsString(e)); logger.error( "exception occurred while performing DmaapSubcriber performanceProcess or alarmProcess. Details:{}", e.getMessage()); @@ -97,7 +100,7 @@ public class DmaapSubscriber implements Runnable { }); } catch (Exception e) { - e.printStackTrace(); + logger.error("getDMaaP Information failed :{}", Throwables.getStackTraceAsString(e)); logger.error("getDMaaP Information failed :{}", e.getMessage()); } } @@ -203,7 +206,7 @@ public class DmaapSubscriber implements Runnable { alarm_header.getLastEpochMicroSec(), alarm_header.getId())); }); } catch (Exception e) { - e.printStackTrace(); + logger.error("convert alarmAdditionalInformation error:{}",Throwables.getStackTraceAsString(e)); logger.error("convert alarmAdditionalInformation error:{}",e.getMessage()); } } @@ -294,7 +297,7 @@ public class DmaapSubscriber implements Runnable { }); }); } catch (Exception e) { - e.printStackTrace(); + logger.error("convert performanceAdditionalInformation error:{}",Throwables.getStackTraceAsString(e)); logger.error("convert performanceAdditionalInformation error:{}",e.getMessage()); } } |