aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src/main
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-07-13 10:05:50 -0500
committerJorge Hernandez <jh1730@att.com>2018-07-13 10:08:19 -0500
commit2db31606da32d9f5d3a16854385de8e496cd28f6 (patch)
tree801d0c77ac09f342b91eb491113dafad4fc70da4 /ONAP-PDP-REST/src/main
parent240bbdbdc76e0e91af9f18164eadb2708d14c6fb (diff)
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 <jh1730@att.com>
Diffstat (limited to 'ONAP-PDP-REST/src/main')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java9
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();
+ }
}
}