From 0c15051e79291c5907b6c7d1bb331c9d5c95fa6e Mon Sep 17 00:00:00 2001 From: rb7147 Date: Thu, 2 Nov 2017 11:07:45 -0400 Subject: [PATCH] Resolved Policy Blocker issue Issue-ID: POLICY-411 Change-Id: I9579a1fa58a4b40aa6aa70a3007b3ce7c02f5ca2 Signed-off-by: rb7147 --- .../controller/CreateDcaeMicroServiceController.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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) { -- 2.16.6