diff options
author | burdziak <olaf.burdziakowski@nokia.com> | 2019-02-18 15:03:58 +0100 |
---|---|---|
committer | burdziak <olaf.burdziakowski@nokia.com> | 2019-02-18 15:03:58 +0100 |
commit | 5ebfbe3184394f4c0ae50cdf08f18f5b743c2925 (patch) | |
tree | 7f9c19b7d7f2ac1dc43732839c4e253776efd6c5 /ecomp-sdk/epsdk-app-common/src/main/java | |
parent | 7b740b078f8fb593c2615e8b6689d30ea46a0c86 (diff) |
Fix sonar issues in FnMenuController
Change-Id: Ie032ac23e4f86a197cff3e3419e799ecf2d895c8
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java index e4c862fd..8f49b640 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java @@ -74,35 +74,35 @@ public class FnMenuController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnMenuController.class); + private static final String UTF8 = "UTF-8"; + @Autowired FnMenuService service; @Autowired FunctionalMenuListService functionalMenuListService; - private String viewName; - @RequestMapping(value = { "/admin_fn_menu/get_parent_list" }, method = RequestMethod.GET) - public void getParentList(HttpServletRequest request, HttpServletResponse response) throws Exception { + public void getParentList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException { ObjectMapper mapper = new ObjectMapper(); try { response.getWriter().write(mapper.writeValueAsString(service.getParentList())); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getParentListFailed", e); - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); out.write("An error occurred in the getParentList () "); } } @RequestMapping(value = { "/admin_fn_menu/get_function_cd_list" }, method = RequestMethod.GET) - public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws Exception { + public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException { ObjectMapper mapper = new ObjectMapper(); try { response.getWriter().write(mapper.writeValueAsString(functionalMenuListService.getFunctionCDList(request))); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getFunctionCDList", e); - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); out.write("An error occurred in the getFunctionCDList ()"); } @@ -153,7 +153,8 @@ public class FnMenuController extends RestrictedBaseController { } @RequestMapping(value = { "/admin_fn_menu/updateFnMenu" }, method = RequestMethod.POST) - public ModelAndView updateFnMenu(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView updateFnMenu(HttpServletRequest request, HttpServletResponse response) + throws java.io.IOException, java.io.UnsupportedEncodingException { try { ObjectMapper mapper = new ObjectMapper(); @@ -166,9 +167,9 @@ public class FnMenuController extends RestrictedBaseController { request.getSession().removeAttribute(SystemProperties.LEFT_MENU_CHILDREND); request.getSession().removeAttribute(SystemProperties.LEFT_MENU_PARENT); - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId())); @@ -179,8 +180,8 @@ public class FnMenuController extends RestrictedBaseController { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "updateFnMenu failed", e); - response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); out.write("An error occurred in the updateFnMenu () "); } @@ -189,7 +190,8 @@ public class FnMenuController extends RestrictedBaseController { } @RequestMapping(value = { "/admin_fn_menu/removeMenuItem" }, method = RequestMethod.POST) - public ModelAndView removeFnMenu(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView removeFnMenu(HttpServletRequest request, HttpServletResponse response) + throws java.io.IOException, java.io.UnsupportedEncodingException { try { ObjectMapper mapper = new ObjectMapper(); @@ -198,9 +200,9 @@ public class FnMenuController extends RestrictedBaseController { Menu fnMenuItem = mapper.readValue(root.get("fnMenuItem").toString(), Menu.class); Menu fnMenuItemRow = service.getMenuItemRow(fnMenuItem.getId()); service.removeMenuItem(fnMenuItemRow); - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); String responseString = mapper.writeValueAsString(service.getMenuItem(fnMenuItem.getId())); out.write(responseString); @@ -209,8 +211,8 @@ public class FnMenuController extends RestrictedBaseController { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "removeFnMenu failed", e); - response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); out.write("An error occurred in the removeFnMenu ()"); } |