summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-03-11 14:06:42 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-03-12 09:12:22 -0400
commit2924fa7d806435a3bf9f2cb5abcdb01aa7295b00 (patch)
tree094c3b2140e492f8ffc700f0232405dcf83d2d2e /main/src
parent2a65ced426b393e9a6fe34c2c64303b1cc83e1a0 (diff)
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 <pdragosh@research.att.com>
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pdpx/main/rest/provider/DecisionProvider.java6
1 files changed, 5 insertions, 1 deletions
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: