summaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST
diff options
context:
space:
mode:
authorKrishnajinka <kris.jinka@samsung.com>2018-07-13 17:54:49 +0900
committerKrishnajinka <kris.jinka@samsung.com>2018-07-13 18:11:36 +0900
commita97e1eafd731937aab373213ab04c3296cc97595 (patch)
treef17368b79fb5f30185ce7a8b782ead09ba43f923 /ONAP-PDP-REST
parent54eaa820dd76f8da6076b6aad3d2c75c68236693 (diff)
fix try block
Issue-ID: POLICY-961 Change-Id: Ia1f388368007a4a82a57520dc6ddd99cc484a393 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
Diffstat (limited to 'ONAP-PDP-REST')
-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();
- }
}
}