From 2db31606da32d9f5d3a16854385de8e496cd28f6 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Fri, 13 Jul 2018 10:05:50 -0500 Subject: Reverting "Merge "fix try block"" This reverts commit 240bbdbdc76e0e91af9f18164eadb2708d14c6fb, reversing changes made to 3ee69f1af0acddd1e06060ad88c0029fe7ceeaaf. Change-Id: I61f07ead1d7d3e89c512a2224efecf9ac440df10 Issue-ID: POLICY-961 Signed-off-by: Jorge Hernandez --- .../java/org/onap/policy/pdp/rest/api/services/PDPServices.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ONAP-PDP-REST/src/main/java') 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(); + } } } -- cgit 1.2.3-korg