diff options
author | burdziak <olaf.burdziakowski@nokia.com> | 2019-02-18 15:47:25 +0100 |
---|---|---|
committer | burdziak <olaf.burdziakowski@nokia.com> | 2019-02-18 15:47:25 +0100 |
commit | f1dd7327d1ef59213016a9077c7d6881649373d8 (patch) | |
tree | c229412916e4a5344db0bc58fb7987faa21fe099 /ecomp-sdk/epsdk-app-common/src/main | |
parent | 7b740b078f8fb593c2615e8b6689d30ea46a0c86 (diff) |
Fix sonar issues in MenuListController
Change-Id: If380c7bfb51f837ae4b8416d49ae42746cb1d818
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java index 5ca764c1..bedd9c41 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java @@ -74,6 +74,8 @@ public class MenuListController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MenuListController.class); + private static final String APPLICATION_JSON = "application/json"; + @Autowired private FnMenuService fnMenuService; @Autowired @@ -110,7 +112,7 @@ public class MenuListController extends RestrictedBaseController { JsonMessage msg = new JsonMessage(mapper.writeValueAsString(parentList), mapper.writeValueAsString(childItemList), userName); JSONObject j = new JSONObject(msg); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); logger.debug(EELFLoggerDelegate.debugLogger, "getMenu ends"); } catch (Exception e) { @@ -132,12 +134,12 @@ public class MenuListController extends RestrictedBaseController { try { String appName = (String) session .getAttribute(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)); - if (appName != null && appName.equals("app_display_name")) { + if (appName != null && "app_display_name".equals(appName)) { appName = ""; } JsonMessage msg = new JsonMessage(appName); JSONObject j = new JSONObject(msg); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); logger.debug(EELFLoggerDelegate.debugLogger, "getAppName ends"); } catch (Exception e) { @@ -194,7 +196,7 @@ public class MenuListController extends RestrictedBaseController { String contextId = null; if (request.getCookies() != null) { for (Cookie ck : request.getCookies()) { - if (ck.getName().equalsIgnoreCase("EPService")) + if ("EPService".equalsIgnoreCase(ck.getName())) contextId = ck.getValue(); } } @@ -207,7 +209,7 @@ public class MenuListController extends RestrictedBaseController { model.put(sharedContext.getCkey(), sharedContext.getCvalue()); } JSONObject j = new JSONObject(model); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getUserInfo failed", e); @@ -248,7 +250,7 @@ public class MenuListController extends RestrictedBaseController { isAppCentralized = true; map.put("isAppCentralized", Boolean.toString(isAppCentralized)); JSONObject j = new JSONObject(map); - response.setContentType("application/json"); + response.setContentType(APPLICATION_JSON); response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "Failed to serialize JSON", e); |