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.