Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.1
    • Component/s: None
    • Labels:
      None

      Description

      ClientWindowFactoryImpl#calculateClientWindow has the following implementation:

          private String calculateClientWindow(FacesContext context) {
              String id = null;
              final String clientWindowCounterKey = "com.sun.faces.lifecycle.ClientWindowCounterKey";
              ExternalContext extContext = context.getExternalContext();
              Map<String, Object> sessionAttrs = extContext.getSessionMap();
              Integer counter = (Integer) sessionAttrs.get(clientWindowCounterKey);
              if (null == counter) {
                  counter = Integer.valueOf(0);
              }
              char sep = UINamingContainer.getSeparatorChar(context);
              id = extContext.getSessionId(true) + sep +
                      + counter;
              
              sessionAttrs.put(clientWindowCounterKey, ++counter);
              
              return id;
          }
      

      I don't think is a very thread safe. If multiple client windows are created at the same time they'll easily end up having the same Id, causing major mayhem.

      Can this be changed into using some AtomicInteger orso that's created when the session is created, or be put into some synchronized block?

        Activity

        Hide
        Manfred Riem added a comment -

        Applied to 2.2 trunk,

        svn commit -m "Fixes http://java.net/jira/browse/JAVASERVERFACES-2799, r=rogerk, synchronize on the user session when using ClientWindowCounterKey"
        Sending jsf-ri\src\main\java\com\sun\faces\lifecycle\ClientWindowImpl.java
        Transmitting file data .
        Committed revision 11858.

        Show
        Manfred Riem added a comment - Applied to 2.2 trunk, svn commit -m "Fixes http://java.net/jira/browse/JAVASERVERFACES-2799 , r=rogerk, synchronize on the user session when using ClientWindowCounterKey" Sending jsf-ri\src\main\java\com\sun\faces\lifecycle\ClientWindowImpl.java Transmitting file data . Committed revision 11858.

          People

          • Assignee:
            Manfred Riem
            Reporter:
            kithouna
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: