From 2924fa7d806435a3bf9f2cb5abcdb01aa7295b00 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Wed, 11 Mar 2020 14:06:42 -0400 Subject: Better error handling for decisions Throw exceptions when requests cannot be created and return error information back. Consolidated some code to avoid sonar duplication issues. Companion review to https://gerrit.onap.org/r/c/policy/models/+/103548 Issue-ID: POLICY-2242 Change-Id: Ic873af933dab82e3aeef6335f55939666be20385 Signed-off-by: Pamela Dragosh --- .../application/monitoring/MonitoringPdpApplication.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'applications/monitoring/src/main/java') diff --git a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java index 436028fd..5c41a9e2 100644 --- a/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java +++ b/applications/monitoring/src/main/java/org/onap/policy/xacml/pdp/application/monitoring/MonitoringPdpApplication.java @@ -22,7 +22,6 @@ package org.onap.policy.xacml.pdp.application.monitoring; -import com.att.research.xacml.api.Request; import com.att.research.xacml.api.Response; import java.util.ArrayList; import java.util.Arrays; @@ -109,17 +108,10 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider public Pair makeDecision(DecisionRequest request, Map requestQueryParams) { // - // Convert to a XacmlRequest + // Make the decision // - Request xacmlRequest = this.getTranslator().convertRequest(request); - // - // Now get a decision - // - Response xacmlResponse = this.xacmlDecision(xacmlRequest); - // - // Convert to a DecisionResponse - // - DecisionResponse decisionResponse = this.getTranslator().convertResponse(xacmlResponse); + Pair decisionPair = super.makeDecision(request, requestQueryParams); + DecisionResponse decisionResponse = decisionPair.getKey(); // // Abbreviate results if needed // @@ -137,7 +129,7 @@ public class MonitoringPdpApplication extends StdXacmlApplicationServiceProvider policy.remove("version"); } } - return Pair.of(decisionResponse, xacmlResponse); + return decisionPair; } @Override -- cgit 1.2.3-korg