Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4041

EL evaluation fails when state is saved because FaceletState object is not present

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.9
    • 2.2.10
    • JSR-344
    • None

    Description

      DefaultFaceletsStateManagementStrategy.saveView(...) contains some lines of code that do this:

                      states = new HashMap<String, Object>();
      
                      faceletViewState = view.getAttributes().get(ComponentSupport.FACELET_STATE_INSTANCE);
                      if (faceletViewState != null)
                      {
                          ((Map<String, Object>)states).put(ComponentSupport.FACELET_STATE_INSTANCE,
                                  UIComponentBase.saveAttachedState(context, faceletViewState));
                          //Do not save on UIViewRoot
                          view.getAttributes().remove(ComponentSupport.FACELET_STATE_INSTANCE);
                      }
      

      The problem is FaceletState is removed to be serialized, but FaceletState is also used for EL expressions (see FaceletStateValueExpression), so every EL expression that is evaluated when the state is being saved that depends on this map throws NullPointerException.

      The problem has been experienced by other users before (see MYFACES-4023 for details), but in the case reported here (treeTable component and dynamic columns) there is no other possible workaround than to preserve FaceletState object so the EL can be properly evaluated.

      The solution is use the transient state helper map to hold FaceletState and change FaceletStateValueExpression to scan for this condition.

      Attachments

        1. MYFACES-4041-1.patch
          2 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            mmarinschek Martin Marinschek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: