diff options
author | 2019-05-17 10:18:57 +0200 | |
---|---|---|
committer | 2019-05-17 10:18:57 +0200 | |
commit | bb4670a9c6fe20d8862ab4aa218e226c09893976 (patch) | |
tree | 97fb30bbf0a7e00183c91c4147f6a5d6af728bbe /ecomp-sdk/epsdk-app-common/src/main/java/org/onap | |
parent | 68eabf669e4c83bd669286900e8a6f77e4009f29 (diff) |
Fix sonar issues in UsageListController
Change-Id: Ia6743652884bc505e7d8694b270bc9b31c14b7c8
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main/java/org/onap')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java index 04c1f2bc..fabc06bf 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java @@ -65,6 +65,8 @@ public class UsageListController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UsageListController.class); + private static final String ACTIVE_USERS = "activeUsers"; + private void addUsers2jsonArray(JSONArray ja,HashMap activeUsers,String httpSessionId) { List<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); @@ -96,10 +98,10 @@ public class UsageListController extends RestrictedBaseController { Map<String, Object> model = new HashMap<>(); HttpSession httpSession = request.getSession(); - HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers"); + HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute(ACTIVE_USERS); if (activeUsers.size() == 0) { activeUsers.put(httpSession.getId(), httpSession); - httpSession.getServletContext().setAttribute("activeUsers", activeUsers); + httpSession.getServletContext().setAttribute(ACTIVE_USERS, activeUsers); } JSONArray ja = new JSONArray(); @@ -119,10 +121,10 @@ public class UsageListController extends RestrictedBaseController { public void getUsageList(HttpServletRequest request, HttpServletResponse response) { HttpSession httpSession = request.getSession(); - HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers"); + HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute(ACTIVE_USERS); if (activeUsers.size() == 0) { activeUsers.put(httpSession.getId(), httpSession); - httpSession.getServletContext().setAttribute("activeUsers", activeUsers); + httpSession.getServletContext().setAttribute(ACTIVE_USERS, activeUsers); } JSONArray ja = new JSONArray(); try { @@ -144,7 +146,7 @@ public class UsageListController extends RestrictedBaseController { @SuppressWarnings("rawtypes") @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET) public void removeSession(HttpServletRequest request, HttpServletResponse response) throws IOException { - HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute("activeUsers"); + HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute(ACTIVE_USERS); UserRowBean data = new UserRowBean(); data.setSessionId(request.getParameter("deleteSessionId")); UsageUtils.getActiveUsersAfterDelete(activeUsers, data); |