summaryrefslogtreecommitdiffstats
path: root/integrity-audit/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-12 10:28:35 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-09-12 12:46:46 -0400
commit65dff31a2e34b14347f1c0311420463c367afd3d (patch)
treebbd5dba3e1f48449c43085ef373e6ca235760bbc /integrity-audit/src
parent5827bc8c28d85f536ac2dff3c4e03ab83f0f8408 (diff)
Fix sonar critical associated with logging
Addressing the following sonar critical: Use a logger to log this exception Either log or rethrow this exception It does not hurt to simply do these as well as clean out lines of code that dump to Sys.out via e.printStackTrace. Issue-ID: POLICY-195 Change-Id: Ibc328094a0653b7baa04778298e4a69955105ea3 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'integrity-audit/src')
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java33
1 files changed, 4 insertions, 29 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
index 20132ae1..b392b555 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDAO.java
@@ -141,10 +141,7 @@ public class DbDAO {
resultMap.put(key, o);
}
}catch(Exception e){
- String msg = "getAllEntries encountered exception: " + e;
- logger.error(msg);
- System.out.println(new Date());
- e.printStackTrace();
+ logger.error("getAllEntries encountered exception: ", e);
}
em.close();
logger.debug("getAllMyEntries: Exit, resultMap.keySet()=" + resultMap.keySet());
@@ -170,10 +167,7 @@ public class DbDAO {
resultMap.put(key, entry);
}
}catch(Exception e){
- String msg = "getAllMyEntries encountered exception: " + e;
- logger.error(msg);
- System.out.println(new Date());
- e.printStackTrace();
+ logger.error("getAllMyEntries encountered exception: ", e);
}
em.close();
@@ -210,10 +204,7 @@ public class DbDAO {
resultMap.put(key, o);
}
}catch(Exception e){
- String msg = "getAllEntries encountered exception:" + e;
- logger.error(msg);
- System.out.println(new Date());
- e.printStackTrace();
+ logger.error("getAllEntries encountered exception:", e);
}
em.close();
@@ -288,9 +279,7 @@ public class DbDAO {
return iaeList;
}catch (Exception e){
String msg = "DbDAO: " + "getIntegrityAuditEntities() " + "ecountered a problem in execution: ";
- logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
+ logger.error(msg, e);
throw new DbDaoTransactionException(e);
}
@@ -454,8 +443,6 @@ public class DbDAO {
}catch (Exception e){
String msg = "DbDAO: " + "register() " + "encountered a problem in execution: ";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(e);
}
@@ -513,8 +500,6 @@ public class DbDAO {
}catch (Exception e){
String msg = "DbDAO: " + "setDesignated() " + "ecountered a problem in execution: ";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(e);
}
@@ -566,8 +551,6 @@ public class DbDAO {
}catch (Exception e){
String msg = "DbDAO: " + "setLastUpdated() " + "ecountered a problem in execution: ";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(e);
}
@@ -609,8 +592,6 @@ public class DbDAO {
}catch (Exception e){
String msg = "DbDAO: " + "deleteAllIntegrityAuditEntities() " + "encountered a problem in execution: ";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(e);
}
@@ -714,8 +695,6 @@ public class DbDAO {
String msg = "DbDAO: " + "changeDesignated() "
+ "caught LockTimeoutException, message=" + e.getMessage();
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(msg, e);
}
else {
@@ -723,8 +702,6 @@ public class DbDAO {
+ "caught LockTimeoutException, message=" + e.getMessage()
+ ". Error rolling back transaction.";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(msg, e);
}
} catch (Exception e) {
@@ -743,8 +720,6 @@ public class DbDAO {
+ "caught LockTimeoutException, message=" + e.getMessage()
+ ". Error rolling back transaction.";
logger.error(msg + e);
- System.out.println(new Date());
- e.printStackTrace();
throw new DbDaoTransactionException(msg, e);
}
}