ICEfaces
  1. ICEfaces
  2. ICE-4677

NullPointerException if user not in role and not logged in

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.2-RC1, 1.8.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      Current Icefaces from trunk
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      SessionDispatcher.inRole method got row with (Collection) activeRequests.get(sessionID)) - this value can be null and should be checked and false returned.

      Show
      SessionDispatcher.inRole method got row with (Collection) activeRequests.get(sessionID)) - this value can be null and should be checked and false returned.

      Description

      NullPointerException is generated if user copy/paste of link from one browser (logged in) to another (not logged in).

      i got page with user role attributes used.

      Stack trace
      java.lang.NullPointerException
      at java.util.ArrayList.<init>(ArrayList.java:131)
      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.inRole(SessionDispatcher.java:148)
      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.access$300(SessionDispatcher.java:29)
      at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$2.isUserInRole(SessionDispatcher.java:98)
      at com.icesoft.faces.context.BridgeExternalContext.isUserInRole(BridgeExternalContext.java:224)
      at com.icesoft.faces.component.ext.taglib.Util.isEnabledOnUserRole(Util.java:155)

        Activity

        Hide
        Krashan Brahmanjara added a comment -

        This patch stops problems and app is correct redirected to main page.

        private boolean inRole(String sessionID, String role) {
        > Collection cl = (Collection) activeRequests.get(sessionID);
        > if (cl!=null){
        Iterator i = new ArrayList(cl).iterator();
        while (i.hasNext()) {
        try {
        HttpServletRequest request = (HttpServletRequest) i.next();
        if (request.isUserInRole(role))

        { return true; }

        } catch (Throwable t)

        { //ignore }

        }
        > }
        return false;
        }

        Show
        Krashan Brahmanjara added a comment - This patch stops problems and app is correct redirected to main page. private boolean inRole(String sessionID, String role) { > Collection cl = (Collection) activeRequests.get(sessionID); > if (cl!=null){ Iterator i = new ArrayList(cl).iterator(); while (i.hasNext()) { try { HttpServletRequest request = (HttpServletRequest) i.next(); if (request.isUserInRole(role)) { return true; } } catch (Throwable t) { //ignore } } > } return false; }
        Hide
        Mark Collette added a comment -

        This is fixed, as described in ICE-4846.

        Show
        Mark Collette added a comment - This is fixed, as described in ICE-4846 .

          People

          • Assignee:
            Mark Collette
            Reporter:
            Krashan Brahmanjara
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: