X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateDcaeMicroServiceController.java;h=43b62b0c0640b9f7ee289e6c0e2a2a2633e5ae93;hb=3898b1b9731035e4e2a37f0428a5f76355c0af15;hp=ff5ccffb033327567d4d6498e4bdc51019574995;hpb=ace557a95b46f994554bac3447136c022bfecab2;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index ff5ccffb0..43b62b0c0 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -411,23 +411,17 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { } + @SuppressWarnings("unchecked") public Map load(String fileName) throws IOException { File newConfiguration = new File(fileName); - InputStream is = null; - try { - is = new FileInputStream(newConfiguration); + Yaml yaml = new Yaml(); + Map yamlMap = null; + try(InputStream is = new FileInputStream(newConfiguration)){ + yamlMap = (Map) yaml.load(is); } catch (FileNotFoundException e) { LOGGER.error(e); } - Yaml yaml = new Yaml(); - - Map yamlMap = null; - try{ - yamlMap = (Map) yaml.load(is); - }catch(Exception e){ - LOGGER.error("load:", e); - } StringBuilder sb = new StringBuilder(); Map settings = new HashMap<>(); if (yamlMap == null) {