From 7da3ddfa40de2f683a2d423d62b78a8d001108eb Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 27 Mar 2020 08:03:24 -0400 Subject: More sonar issues cleanup Either log or rethrow Use boolean expression Add at least one test Remove commented out code Issue-ID: POLICY-2204 Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe Signed-off-by: Pamela Dragosh --- .../java/org/onap/policy/common/im/IntegrityMonitor.java | 12 ++++++------ .../main/java/org/onap/policy/common/im/StateManagement.java | 2 -- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'integrity-monitor/src/main/java/org/onap') diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java index 1372b4fc..d96aa44a 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java @@ -925,7 +925,7 @@ public class IntegrityMonitor { } // check the next group - } // end for (String group : depGroups) + } return dependencyOk; } @@ -963,7 +963,7 @@ public class IntegrityMonitor { appendSeparator(errorMsg); errorMsg.append(failMsg); } - } // end for (String dep : dependencies) + } // if all dependencies in a group are failed, set this // resource's state to disable dependency @@ -1206,7 +1206,7 @@ public class IntegrityMonitor { } catch (Exception e1) { logger.error(EXCEPTION_STRING, e1); } - logger.error("writeFpc DB table commit failed with exception", e); + logger.error("writeFpc DB table commit failed with exception"); throw e; } } @@ -1500,8 +1500,8 @@ public class IntegrityMonitor { if (sme != null && !sme.getOpState().equals(StateManagement.DISABLED)) { disableFailed(sme); } - } // end if(diffMs > staleMs) - } // end for(ForwardProgressEntity fpe : fpList) + } + } logger.debug("IntegrityMonitor.executeStateAudit(): exit"); } @@ -1817,7 +1817,7 @@ public class IntegrityMonitor { allNotWellMap = new HashMap<>(); } - if (asw) { + if (Boolean.TRUE.equals(asw)) { logger.info("allSeemsWell: ALL SEEMS WELL: key = {}, msg = {}", key, msg); allSeemsWellMap.put(key, msg); allNotWellMap.remove(key); diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java index 7a018ef9..65ebf2d2 100644 --- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java +++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateManagement.java @@ -174,7 +174,6 @@ public class StateManagement { logger.debug("StateManagement: {}() operation completed, resourceName = {}", methodName, resourceName); } catch (final Exception ex) { - logger.error("StateManagement.{}() caught unexpected exception: ", methodName, ex); throw new StateManagementException("StateManagement." + methodName + "() Exception: " + ex); } } @@ -476,7 +475,6 @@ public class StateManagement { } } catch (final Exception ex) { final String message = "findStateManagementEntity exception"; - logger.error("{}: {}", message, ex.toString(), ex); throw new EntityRetrievalException(message, ex); } } -- cgit 1.2.3-korg