diff options
Diffstat (limited to 'ONAP-PDP-REST/src/main/java')
-rw-r--r-- | ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java | 9 |
1 files changed, 7 insertions, 2 deletions
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 8722de4fe..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 @@ -340,9 +340,10 @@ public class PDPServices { if(pdpConfigLocation.contains("/")){ pdpConfigLocation = pdpConfigLocation.replace("/", File.separator); } - + InputStream inputStream = null; JsonReader jsonReader = null; - try(InputStream inputStream = new FileInputStream(new File(pdpConfigLocation))) { + try { + inputStream = new FileInputStream(new File(pdpConfigLocation)); try { if (pdpConfigLocation.endsWith("json")) { pdpResponse.setType(PolicyType.JSON); @@ -412,6 +413,10 @@ public class PDPServices { } catch (FileNotFoundException e) { LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e); throw new PDPException(XACMLErrorConstants.ERROR_DATA_ISSUE + "Error in ConfigURL", e); + }finally{ + if(inputStream != null){ + inputStream.close(); + } } } |