diff options
author | Jim Hahn <jrh3@att.com> | 2019-10-30 14:47:54 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-10-30 18:28:40 -0400 |
commit | b8f2cbe2bd9e670b12f5cb4cad277884ba702a11 (patch) | |
tree | 37ec216806fbdcc58486c29d38b7ad3baf3c8312 /policy-management/src | |
parent | a47aedf7bffd6c889a24a99ae3b4614770a1a269 (diff) |
Fix more sonar issues in drools-pdp
Sonar issue fixed:
- log or rethrow exception
- empty code block; moved the comment inside the empty "synchronized" block
Change-Id: I55ca87a321b3a1e4079dae6d5a4d44b651cb3086
Issue-ID: POLICY-2203
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management/src')
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java | 8 | ||||
-rw-r--r-- | policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java index c5841b06..8b807387 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java @@ -89,6 +89,7 @@ import org.slf4j.LoggerFactory; tags = {@Tag(name = "pdp-d-telemetry", description = "Drools PDP Telemetry Operations")}) public class RestManager { + private static final String OFFER_FAILED = "{}: cannot offer to topic {} because of {}"; private static final String CANNOT_PERFORM_OPERATION = "cannot perform operation"; private static final String NO_FILTERS = " no filters"; private static final String NOT_FOUND = " not found: "; @@ -2085,17 +2086,16 @@ public class RestManager { .build(); } } catch (IllegalArgumentException e) { - logger.debug("{}: cannot offer to topic {} because of {}", this, topic, e.getMessage(), - e); + logger.debug(OFFER_FAILED, this, topic, e.getMessage(), e); return Response.status(Response.Status.NOT_FOUND) .entity(new Error(topic + NOT_FOUND_MSG)).build(); } catch (IllegalStateException e) { - logger.debug("{}: cannot offer to topic {} because of {}", this, topic, e.getMessage(), - e); + logger.debug(OFFER_FAILED, this, topic, e.getMessage(), e); return Response.status(Response.Status.NOT_ACCEPTABLE) .entity(new Error(topic + " not acceptable due to current state")) .build(); } catch (Exception e) { + logger.debug(OFFER_FAILED, this, topic, e.getMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new Error(e.getMessage())) .build(); } diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java index c924fd69..757b67fa 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java @@ -841,8 +841,8 @@ class PolicyEngineManager implements PolicyEngine { logger.warn("{}: abnormal termination - shutdown graceful time period expiration", PolicyEngineManager.this); } catch (final InterruptedException e) { - /* courtesy to shutdown() to allow it to return */ synchronized (PolicyEngineManager.this) { + /* courtesy to shutdown() to allow it to return */ } logger.info("{}: finishing a graceful shutdown ", PolicyEngineManager.this, e); } finally { |