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 --- .../org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'main/src') diff --git a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java index 1c83b058..24d03281 100644 --- a/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java +++ b/main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -112,6 +112,10 @@ public class DecisionProvider { } private void calculateStatistic(Response xacmlResponse) { + if (xacmlResponse == null) { + XacmlPdpStatisticsManager.getCurrent().updateErrorCount(); + return; + } for (Result result : xacmlResponse.getResults()) { switch (result.getDecision()) { case PERMIT: -- cgit 1.2.3-korg