[
https://issues.apache.org/jira/browse/TRINIDAD-2069?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13010423#comment-13010423
]
Gabrielle Crawford commented on TRINIDAD-2069:
----------------------------------------------
For background the renderKit id is
saved as component state on the view root, and it's not being restored during
restore view.
In org.apache.myfaces.trinidadinternal.application.StateManagerImpl.saveView
we are calling this code
Object structure = !_needStructure(context) ? null :
new Structure(viewRoot);
Object state = viewRoot.processSaveState(context);
viewState = new Object[]{structure, state};
in
org.apache.myfaces.trinidadinternal.application.StateManagerImpl.restoreView
we are using this code:
structure = rsm.getTreeStructureToRestore(context, viewId);
state = rsm.getComponentStateToRestore(context);
Normally when you run trin/rich client the responseStateManager used is
org.apache.myfaces.trinidadinternal.renderkit.core.CoreResponseStateManager,
which returns a value from getComponentStateToRestore.
In the case that's failing state is null (remember that the renderKit id is
saved as component state on the view root). The reason the state is null is
that when you use the HTML_BASIC renderkit, you are not using
CoreResponseStateManager, instead you are calling getComponentStateToRestore
on javax.faces.render.ResponseStateManager, and that method returns null.
getComponentStateToRestore is a deprecated method. Changing the code in
restoreView to the following fixes the issue.
Object[] stateArray = (Object[])rsm.getState(context, viewId);
structure = stateArray[0];
state = stateArray[1];
> when trinidad on class path get NPE using html_basic render kit
> ---------------------------------------------------------------
>
> Key: TRINIDAD-2069
> URL: https://issues.apache.org/jira/browse/TRINIDAD-2069
> Project: MyFaces Trinidad
> Issue Type: Bug
> Affects Versions: 2.0.0-beta-2
> Reporter: Gabrielle Crawford
> Assignee: Gabrielle Crawford
>
> Trinidad is on the class path, but using html_basic renderkit.
> When doing a postback we get
> java.lang.NullPointerException
> at
> javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:1269)
> at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)
> at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1048)
> at
> javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1043)
> at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:922)
> at
> com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:74)
> at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
> at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira