diff options
author | r.bogacki <r.bogacki@samsung.com> | 2019-03-19 14:27:16 +0100 |
---|---|---|
committer | Robert Bogacki <r.bogacki@samsung.com> | 2019-03-28 06:56:23 +0000 |
commit | 0a358ea9fd56796d7dcf9c2a50df82a4f05b9738 (patch) | |
tree | 8236f863b96b429e109d398d992782b48c803104 /src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java | |
parent | cf8096a9fe50de511d5864032ed4825a2a314fa5 (diff) |
Log stack traces with logger
Fixed critical sonar issues:
-"Either log or rethrow this exception"
Change-Id: I99a550f2cf40bd6c34a0f8ca1893c964669c76de
Issue-ID: MUSIC-367
Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java')
-rw-r--r-- | src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java index 045abd98..69ccd104 100644 --- a/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java +++ b/src/main/java/org/onap/music/conductor/conditionals/MusicConditional.java @@ -3,7 +3,9 @@ * org.onap.music * =================================================================== * Copyright (c) 2017 AT&T Intellectual Property + * =================================================================== * Modifications Copyright (C) 2019 IBM. + * Modifications Copyright (c) 2019 Samsung * =================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,6 +114,7 @@ public class MusicConditional { return lockAcqResult; } } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, e); MusicCore.destroyLockRef(lockId); return new ReturnType(ResultType.FAILURE, e.getMessage()); } @@ -130,6 +133,7 @@ public class MusicConditional { try { results = MusicDataStoreHandle.getDSHandle().executeQuorumConsistencyGet(queryBank.get(MusicUtil.SELECT)); } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, e.getMessage()); } if (results.all().isEmpty()) { @@ -148,6 +152,7 @@ public class MusicConditional { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, "Exception thrown while doing the critical put, check sanctity of the row/conditions:\n" + exceptionAsString); @@ -175,6 +180,7 @@ public class MusicConditional { } catch (Exception e) { MusicCore.destroyLockRef(lockId); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, e.getMessage()); } @@ -202,6 +208,7 @@ public class MusicConditional { try { MusicDataStoreHandle.getDSHandle().executePut(update, "critical"); } catch (Exception ex) { + logger.error(EELFLoggerDelegate.applicationLogger, ex); return new ReturnType(ResultType.FAILURE, ex.getMessage()); } }else { @@ -219,6 +226,7 @@ public class MusicConditional { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String exceptionAsString = sw.toString(); + logger.error(EELFLoggerDelegate.applicationLogger, e); return new ReturnType(ResultType.FAILURE, "Exception thrown while doing the critical put, check sanctity of the row/conditions:\n" + exceptionAsString); @@ -275,7 +283,8 @@ public class MusicConditional { try { colType = tableInfo.getColumn(entry.getKey()).getType(); } catch(NullPointerException ex) { - logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() +" Invalid column name : "+entry.getKey(), AppMessages.INCORRECTDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR); + logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage() +" Invalid column name : "+entry.getKey + (), AppMessages.INCORRECTDATA ,ErrorSeverity.CRITICAL, ErrorTypes.DATAERROR, ex); } @@ -283,7 +292,7 @@ public class MusicConditional { try { formattedValue = MusicUtil.convertToActualDataType(colType, valueObj); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger,e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e); } valueString.append("?"); |