X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdp%2Frest%2Fapi%2Fservices%2FPDPServices.java;h=af7112ebd96616b51213afa13d805009686a28fb;hb=eef3c224cb6cad4b82a96938ade1e42ca881eea2;hp=efaa5c1673caab127d552192777a068c00734645;hpb=80f072f60509ef3a35369a60857fe05f6c2a993a;p=policy%2Fengine.git diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java index efaa5c167..af7112ebd 100644 --- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java +++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java @@ -128,7 +128,7 @@ public class PDPServices { LOGGER.info("Decision not a Permit. " + result.getDecision().toString()); PDPResponse pdpResponse = new PDPResponse(); if (decide) { - String indeterminatePropValue = XACMLProperties.getProperty("decision.inStringdeterminate.response"); + String indeterminatePropValue = XACMLProperties.getProperty("decision.indeterminate.response"); if(result.getDecision().equals(Decision.INDETERMINATE)&& indeterminatePropValue != null){ if("PERMIT".equalsIgnoreCase(indeterminatePropValue)){ pdpResponse.setDecision(PolicyDecision.PERMIT); @@ -341,12 +341,13 @@ public class PDPServices { pdpConfigLocation = pdpConfigLocation.replace("/", File.separator); } InputStream inputStream = null; + JsonReader jsonReader = null; try { inputStream = new FileInputStream(new File(pdpConfigLocation)); try { if (pdpConfigLocation.endsWith("json")) { pdpResponse.setType(PolicyType.JSON); - JsonReader jsonReader = Json.createReader(inputStream); + jsonReader = Json.createReader(inputStream); pdpResponse.setConfig(jsonReader.readObject().toString()); jsonReader.close(); } else if (pdpConfigLocation.endsWith("xml")) { @@ -400,6 +401,14 @@ public class PDPServices { LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e); throw new PDPException(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Cannot open a connection to the configURL", e); + } finally { + if(jsonReader != null) { + try { + jsonReader.close(); + } catch (Exception e) { + LOGGER.error("Exception Occured while closing the JsonReader"+e); + } + } } } catch (FileNotFoundException e) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);