aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-07-13 14:05:15 +0000
committerGerrit Code Review <gerrit@onap.org>2018-07-13 14:05:15 +0000
commit240bbdbdc76e0e91af9f18164eadb2708d14c6fb (patch)
treedb458f5608b1d003df7cc359b790eeb829866d26 /ONAP-PDP-REST/src
parent3ee69f1af0acddd1e06060ad88c0029fe7ceeaaf (diff)
parenta97e1eafd731937aab373213ab04c3296cc97595 (diff)
Merge "fix try block"
Diffstat (limited to 'ONAP-PDP-REST/src')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java9
1 files changed, 2 insertions, 7 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 af7112ebd..8722de4fe 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,10 +340,9 @@ public class PDPServices {
if(pdpConfigLocation.contains("/")){
pdpConfigLocation = pdpConfigLocation.replace("/", File.separator);
}
- InputStream inputStream = null;
+
JsonReader jsonReader = null;
- try {
- inputStream = new FileInputStream(new File(pdpConfigLocation));
+ try(InputStream inputStream = new FileInputStream(new File(pdpConfigLocation))) {
try {
if (pdpConfigLocation.endsWith("json")) {
pdpResponse.setType(PolicyType.JSON);
@@ -413,10 +412,6 @@ 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();
- }
}
}