X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fadmin%2FPolicyRestController.java;h=2c04bc66dd36f2f9f3b5268d786f0460947ddd72;hp=582dd6c68d8b6b513879061f0d09db82c6cb16b9;hb=fc5c07705edc4dcb7083b39116a43844bb6a1490;hpb=d9007d680d19734d5dc106479784c420236cca4b diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java index 582dd6c68..2c04bc66d 100644 --- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java +++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java @@ -380,14 +380,21 @@ public class PolicyRestController extends RestrictedBaseController{ public ModelAndView searchDictionaryController(HttpServletRequest request, HttpServletResponse response) throws Exception{ Object resultList = null; String uri = request.getRequestURI(); - String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim()); - if(body.contains("CouldNotConnectException")){ + try{ + String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim()); + if(body.contains("CouldNotConnectException")){ + List data = new ArrayList<>(); + data.add("Elastic Search Server is down"); + resultList = data; + }else{ + JSONObject json = new JSONObject(body); + resultList = json.get("policyresult"); + } + }catch(Exception e){ + policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception Occured while querying Elastic Search: " + e); List data = new ArrayList<>(); data.add("Elastic Search Server is down"); resultList = data; - }else{ - JSONObject json = new JSONObject(body); - resultList = json.get("policyresult"); } response.setCharacterEncoding(PolicyController.getCharacterencoding());