X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PDP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpdp%2Frest%2Fapi%2Fservices%2FPDPServices.java;h=8722de4fea3b4360e80c5e9f028dda1ef39bd4af;hb=a97e1eafd731937aab373213ab04c3296cc97595;hp=af7112ebd96616b51213afa13d805009686a28fb;hpb=54eaa820dd76f8da6076b6aad3d2c75c68236693;p=policy%2Fengine.git 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(); - } } }