summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-common
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-03-12 14:27:48 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-12 14:27:48 +0000
commitc41e285f810412f9ef79ae066c546f4de5a7adee (patch)
treeee0a00e3080322985301ebaa0302ca4084bbc70c /ecomp-sdk/epsdk-app-common
parentc71749fb73e1f7e2487b8b56bb52788842634758 (diff)
parentf1dd7327d1ef59213016a9077c7d6881649373d8 (diff)
Merge "Fix sonar issues in MenuListController"
Diffstat (limited to 'ecomp-sdk/epsdk-app-common')
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java14
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);