summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-09-16 13:09:46 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-09 12:08:59 -0400
commitc19f81387f4efc666cfa45b000275f3ee7c1d9d1 (patch)
tree0c6ffe39a15e95f01d40e5a7214bc0d5a9bfa232 /main
parent6f145256b9d9ac6c0e0b6073afb5d1fa178a84a4 (diff)
Sonar xacml-pdp issues
Either log or re-throw exception Refactor to not nest more than 3 statements Refactor to throw at most one exception Move variable to comply with Java Code conventions String literal on LHS Issue-ID: POLICY-2079 Change-Id: Iac33623ef4694cf38c4a69c8f0b9040d8439998e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
index 3de830e3..5b17c34e 100644
--- a/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
+++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/XacmlPdpRestController.java
@@ -55,6 +55,8 @@ import org.onap.policy.pdpx.main.rest.model.StatisticsReport;
import org.onap.policy.pdpx.main.rest.provider.DecisionProvider;
import org.onap.policy.pdpx.main.rest.provider.HealthCheckProvider;
import org.onap.policy.pdpx.main.rest.provider.StatisticsProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Class to provide xacml pdp REST services.
@@ -70,8 +72,10 @@ import org.onap.policy.pdpx.main.rest.provider.StatisticsProvider;
schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
securityDefinition = @SecurityDefinition(basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
public class XacmlPdpRestController {
+ private static final Logger LOGGER = LoggerFactory.getLogger(XacmlPdpRestController.class);
public static final String APPLICATION_YAML = "application/yaml";
+
@GET
@Path("/healthcheck")
@ApiOperation(value = "Perform a system healthcheck",
@@ -176,6 +180,7 @@ public class XacmlPdpRestController {
return addLoggingHeaders(addVersionControlHeaders(Response.status(Response.Status.OK)), requestId)
.entity(new DecisionProvider().fetchDecision(body)).build();
} catch (DecisionException e) {
+ LOGGER.error("Decision exception", e);
XacmlPdpStatisticsManager.getCurrent().updateErrorCount();
return addLoggingHeaders(
addVersionControlHeaders(Response.status((e.getErrorResponse().getResponseCode()))), requestId)