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=0a9a9ba8afe11d0566b092c22f22918cdcb876ab;hp=a1b3519add0b608ce0c390641cbe9bbcbc4702b5;hpb=046653e9ef93acd6d480701f628cbc8dcb91e710;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 a1b3519ad..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) { @@ -1540,6 +1534,14 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { @RequestMapping(value={"/ms_dictionary/set_MSModelData"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) public void SetMSModelData(HttpServletRequest request, HttpServletResponse response) throws IOException, FileUploadException{ + modelList = new ArrayList<>(); + dirDependencyList = new ArrayList<>(); + classMap = new HashMap<>(); + retmap = new HashMap<>(); + uniqueKeys= new HashSet<>(); + uniqueDataKeys= new HashSet<>(); + dataListBuffer=new StringBuilder(); + dataConstraints= new ArrayList <>(); List items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); boolean zip = false; boolean yml= false;