summaryrefslogtreecommitdiffstats
path: root/integrity-audit/src/main/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-04-06 11:26:13 -0400
committerJim Hahn <jrh3@att.com>2020-04-06 11:41:32 -0400
commit82ac8775dfa540fa856ecfd284c69afa44790dd8 (patch)
tree551db3b365be7a0a13aabaa1c52191079d305369 /integrity-audit/src/main/java
parenta56d3929f2387252525577fb36f9e03933064b8f (diff)
More sonar issues in common
Fixed additional sonar issues: - infinit loop; while the issue is bogus, it was easy enough to modify the code to satisfy sonar - doesn't like "volatile"; again, the issue is bogus, but easy enough to modify the code Disabled a couple of sonars in NetworkUtil, as they are not actually an issue. Issue-ID: POLICY-2305 Change-Id: I5500183e3fe4060696994cff55bdae4ba7e138c7 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'integrity-audit/src/main/java')
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
index 25335540..accef643 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java
@@ -169,7 +169,9 @@ public class AuditThread extends Thread {
IntegrityAuditEntity thisEntity;
integrityAudit.setThreadInitialized(true); // An exception will set it to false
- while (true) {
+ boolean interrupted = false;
+
+ while (!interrupted) {
try {
/*
* It may have been awhile since we last cycled through this loop, so refresh
@@ -208,16 +210,16 @@ public class AuditThread extends Thread {
if (isInterruptedException(e)) {
String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage() + "; Stopping.";
logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
- break;
- }
+ interrupted = true;
- String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage()
- + "; Will try audit again in " + integrityAuditPeriodSeconds + " seconds";
- logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
- // Sleep and try again later
- AuditorTime.getInstance().sleep(integrityAuditPeriodSeconds * 1000L);
+ } else {
+ String msg = "AuditThread.run loop - Exception thrown: " + e.getMessage()
+ + "; Will try audit again in " + integrityAuditPeriodSeconds + " seconds";
+ logger.error(MessageCodes.EXCEPTION_ERROR, e, msg);
+ // Sleep and try again later
+ AuditorTime.getInstance().sleep(integrityAuditPeriodSeconds * 1000L);
+ }
}
-
}
}