javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-1256

FacesContextWrapper should call FacesContext.setCurrentinstance(this) in its default constructor

    Details

    • Type: Improvement Improvement
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      A common mistake when wrapping FacesContext is to forget to call FacesContext.setCurrentInstance(this) from within the constructor of the new CustomFacesContext extending FacesContextWrapper. Without that call, FacesServlet will use the wrapped FacesContext, but FacesContext.getCurrentInstance() would only return the wrapped RI's FacesContextImpl, but not the wrapper chain.

      The call of FacesContext.setCurrentInstace(this) in the default constructor of FacesContextWrapper would prevent this mistake easily.

        Activity

        Hide
        Ed Burns added a comment -

        r=edburns.

        Show
        Ed Burns added a comment - r=edburns.
        Hide
        Manfred Riem added a comment -

        Applied to 2.2 branch,

        svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3141, r=edburns, make sure the correct FacesContext is set by a wrapped FacesContext."
        Sending jsf-api/src/main/java/javax/faces/context/FacesContextWrapper.java
        Transmitting file data .
        Committed revision 12783.

        Show
        Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3141 , r=edburns, make sure the correct FacesContext is set by a wrapped FacesContext." Sending jsf-api/src/main/java/javax/faces/context/FacesContextWrapper.java Transmitting file data . Committed revision 12783.
        Hide
        Manfred Riem added a comment -

        Applied to 2.2 branch,

        svn commit -m "Reverting as this violates the current TCK"
        Sending jsf-api/src/main/java/javax/faces/context/FacesContextWrapper.java
        Transmitting file data .
        Committed revision 12786.

        Show
        Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Reverting as this violates the current TCK" Sending jsf-api/src/main/java/javax/faces/context/FacesContextWrapper.java Transmitting file data . Committed revision 12786.
        Hide
        Manfred Riem added a comment -

        Issue moved to the SPEC tracker as affecting the current fix violates tests in the TCK. Hence this has to wait for the next SPEC cycle.

        Show
        Manfred Riem added a comment - Issue moved to the SPEC tracker as affecting the current fix violates tests in the TCK. Hence this has to wait for the next SPEC cycle.
        Hide
        Ed Burns added a comment -

        Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

        Show
        Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          People

          • Assignee:
            Unassigned
            Reporter:
            Hanspeter Duennenberger
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: