[
https://issues.jboss.org/browse/RF-13452?page=com.atlassian.jira.plugin.s...
]
Lutz Ulrich edited comment on RF-13452 at 4/2/14 7:42 AM:
----------------------------------------------------------
Some notes on the issue:
First, it seems redundant that {{UIDataAdaptor}} subscribes itself for
{{PostRestoreStateEvent}}.
If I get the JSF specification right (JSF 2.0, section 2.2.1),
processEvent(ComponentSystemEvent) has to be invoked by the JSF implementation anyway for
each UIComponent when it is restored. Debugging Mojarra (2.1.28) indicates that this
actually happens.
Furthermore, I just added a workaround description. The most simple solution for you to
fix the problem seems to be to just implement some {{ComponentSystemEventListener}} and
register an instance of that class on the {{UIDataAdaptor}} for {{PostAddToViewEvent}},
instead of the {{UIDataAdaptor}}. The listener's implementation of
{{processEvent(ComponentSystemEvent)}} just delegates:
{{event.getComponent().processEvent(event)}}.
Also note that {{UIFileUpload}} imposes a similar Problem, because {{AbstractFileUpload}}
is a listener for {{PostAddToViewEvent}} by annotation as well.
was (Author: lutzulrich):
Some notes on the issue:
First, it seems redundant that UIDataAdaptor subscribes itself for
{{PostRestoreStateEvent}}.
If I get the JSF specification right (JSF 2.0, section 2.2.1),
processEvent(ComponentSystemEvent) has to be invoked by the JSF implementation anyway for
each UIComponent when it is restored. Debugging Mojarra (2.1.28) indicates that this
actually happens.
Furthermore, I just added a workaround description. The most simple solution for you to
fix the Problem seems to be to just implement some {{ComponentSystemEventListener}} and
register an instance of that class on the {{UIDataAdaptor}} for {{PostAddToViewEvent}},
instead of the {{UIDataAdaptor}}. The listener's implementation of
{{processEvent(ComponentSystemEvent)}} just delegates:
{{event.getComponent().processEvent(event)}}.
UIDataAdaptor must not register as listener for PostAddToViewEvent in
its constructor
-------------------------------------------------------------------------------------
Key: RF-13452
URL:
https://issues.jboss.org/browse/RF-13452
Project: RichFaces
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: compatibility
Affects Versions: 4.3.4, 4.3.5
Environment: Mojarra 2.1.?? - 2.1.28
Reporter: Lutz Ulrich
Labels: UIDataAdaptor, UIDataTable, dynamical-add
Fix For: 5-Tracking
Whenever a component which is based on {{org.richfaces.component.UIDataAdaptor}} is added
dynamically, NPE occurs in the next RESTORE_VIEW Phase when using Mojarra 2.1.x.
My first guess was, that this would be an error in Mojarra (issue 2152, see
https://java.net/jira/browse/JAVASERVERFACES-2152?page=com.atlassian.jira...
),
which occurs whenever a sub-class of {{UIComponent}} registers itself as
{{javax.faces.event.SystemEventListener}} for
{{javax.faces.event.PostAddToViewEvent}} in ist constructor, just like {{UIDataAdaptor}}
does.
Now, Manfred Riem of Mojarra argues (in the very issue named above), that registering for
PostAddToView in the constructor is a design flaw in itself.
Note that the error occurs with every UIComponent which is added dynamically and which
registers itself as PostAddToView listener in its constructor. For the Mojarra issue, I
provided a simple component which extends the standard JSF HtmlOutputText and registers
itself in its constructor, too. Baam - same error. So maybe more components of RichFaces
are affected - not just those based on {{UIDataAdaptor}}.
For completion, here is a stack trace:
{quote}
Schwerwiegend: java.lang.NullPointerException
at
javax.faces.component.UIComponent$ComponentSystemEventListenerAdapter.processEvent(UIComponent.java:2526)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at
com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2163)
at
com.sun.faces.application.ApplicationImpl.invokeComponentListenersFor(ApplicationImpl.java:2111)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:289)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:247)
at
javax.faces.component.UIComponentBase.publishAfterViewEvents(UIComponentBase.java:2203)
at javax.faces.component.UIComponentBase.doPostAddProcessing(UIComponentBase.java:1885)
at javax.faces.component.UIComponentBase.setParent(UIComponentBase.java:405)
at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2637)
at javax.faces.component.UIComponentBase$ChildrenList.add(UIComponentBase.java:2609)
at
com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreDynamicAdd(FaceletPartialStateManagementStrategy.java:421)
at
com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreDynamicActions(FaceletPartialStateManagementStrategy.java:247)
at
com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:570)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
at
com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at
com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:653)
at
com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:301)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
{quote}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira