Hi Ok, I found the bug. It was related to some optimization done in rendererType. In few words, this field should be restored before system event listeners, so UIComponent.getCurrentComponent(context).getRenderer(context) can restore the right renderer.
The solution is just reorganize UIComponentBase.restoreState. Please create an issue in: https://issues.apache.org/jira/browse/MYFACES And I'll commit the solution as soon as the issue is created. Thanks for your help solving this issue, it is very helpful to receive feedback from our snapshot artifacts. regards, Leonardo Uribe 2012/3/20 Wojtek K <[email protected]>: > Thanks for adivce Leonardo. > This helps (for my test). > Later i check with our "real" project. > > wojtek > > > > Dnia 20-03-2012 o godz. 17:09 Leonardo Uribe napisał(a): >> Hi >> >> I almost forget to say one advice. Please try to remove: >> >> <context-param> >> >> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name> >> <param-value>true</param-value> >> </context-param> >> >> <context-param> >> >> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name> >> <param-value>true</param-value> >> </context-param> >> >> so org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS will set to auto >> mode. Recent changes in 2.1.6 / 2.1.7 has improved that part. Maybe >> your code will work doing that. >> >> regards, >> >> Leonardo Uribe >> >> 2012/3/20 Leonardo Uribe <[email protected]>: >> > Hi >> > >> > I checked the stacktrace and the code looks good. There are not recent >> > changes that could affect in that location. >> > >> > The issue should be caused by a listener that is not restored >> > correctly. Take a look at your <f:event listener="..", @ListenerFor >> > annotations. One suposition is you have registered a listener in a >> > renderer using @ListenerFor or you have registered programatically a >> > renderer as a listener, but the renderer does not belong to the same >> > component and the restore code (see the line for restore renderer): >> > >> > //Full restore >> > listenerCapability = (Integer) values[2]; >> > >> > if ((listenerCapability & LISTENER_TYPE_COMPONENT) != 0) >> > { >> > listener = UIComponent.getCurrentComponent(context); >> > } >> > else if ((listenerCapability & LISTENER_TYPE_RENDERER) != >> 0) >> > { >> > listener = (ComponentSystemEventListener) >> > >> > UIComponent.getCurrentComponent(context).getRenderer(context); >> > } >> > else >> > { >> > listener = (ComponentSystemEventListener) >> > >> > UIComponentBase.restoreAttachedState(context, values[1]); >> > } >> > >> > will cause a class cast exception. If that's the case, please let us >> > know the use case to add the additional check and force save the >> > renderer class in such cases. In other case, to solve this issue it is >> > necessary provide a test case. >> > >> > regards, >> > >> > Leonardo Uribe >> > >> > 2012/3/20 Werner Punz <[email protected]>: >> >> Best bet is to file a bugreport to get this fixed asap. >> >> >> >> Werner >> >> >> >> >> >> Am 19.03.12 22:14, schrieb Wojtek K: >> >> >> >>> Hello! >> >>> >> >>> >> >>> >> >>> Recently we switched from myfaces 2.1.6 to 2.1.7-SNAPSHOT (in 2.1.6 we >> >>> have problems with ui:repeat). >> >>> >> >>> >> >>> >> >>> With 2.1.7-SNAPSHOT sometimes we see this stacktrace: >> >>> >> >>> >> >>> >> >>> Caused by: java.lang.ClassCastException: >> >>> org.apache.myfaces.renderkit.html.HtmlTextRenderer cannot be cast to >> >>> javax.faces.event.ComponentSystemEventListener >> >>> at >> >>> javax.faces.component.UIComponent$EventListenerWrapper.restoreState(UIComponent.java:1600) >> >>> at >> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878) >> >>> at javax.faces.component._DeltaList.restoreState(_DeltaList.java:254) >> >>> at >> >>> javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1878) >> >>> at >> >>> javax.faces.component.UIComponentBase.restoreFullSystemEventListenerClassMap(UIComponentBase.java:2181) >> >>> at >> >>> javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:2021) >> >>> at javax.faces.component.UIOutput.restoreState(UIOutput.java:209) >> >>> at >> >>> javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1593) >> >>> at >> >>> org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy$2.invokeContextCallback(DefaultFaceletsStateManagementStrategy.java:441) >> >>> at >> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:227) >> >>> at >> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136) >> >>> at >> >>> javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:238) >> >>> at >> >>> javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:1136) >> >>> >> >>> >> >>> >> >>> Our views are very complicated so i can't find what is wrong. >> >>> >> >>> Can this be bug in myfaces? or it is problem in ours views? >> >>> >> >>> >> >>> >> >>> web.xml >> >>> >> >>> >> >>> >> >>> <context-param> >> >>> >> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE</param-name> >> >>> <param-value>true</param-value> >> >>> </context-param> >> >>> >> >>> <context-param> >> >>> >> >>> <param-name>org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS</param-name> >> >>> <param-value>true</param-value> >> >>> </context-param> >> >>> >> >>> <context-param> >> >>> <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name> >> >>> <param-value>true</param-value> >> >>> </context-param> >> >>> >> >>> >> >>> thanks >> >>> >> >>> >> >>> >> >>> wojtek >> >>> >> >>> >> >>> >> >> >> >> > > >

