You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2016/04/06 04:38:25 UTC

[jira] [Commented] (MYFACES-4041) EL evaluation fails when state is saved because FaceletState object is not present

    [ https://issues.apache.org/jira/browse/MYFACES-4041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15227594#comment-15227594 ] 

Leonardo Uribe commented on MYFACES-4041:
-----------------------------------------

After some tests, the issue happens when org.apache.myfaces.CACHE_EL_EXPRESSIONS web config param is set to alwaysRecompile, so it is not blocker issue after all.

> EL evaluation fails when state is saved because FaceletState object is not present
> ----------------------------------------------------------------------------------
>
>                 Key: MYFACES-4041
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4041
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-344
>    Affects Versions: 2.2.9
>            Reporter: Martin Marinschek
>            Assignee: Leonardo Uribe
>            Priority: Blocker
>             Fix For: 2.2.10
>
>         Attachments: MYFACES-4041-1.patch
>
>
> DefaultFaceletsStateManagementStrategy.saveView(...) contains some lines of code that do this:
> {code:java}
>                 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);
>                 }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)