[richfaces-issues] [JBoss JIRA] (RF-13452) UIDataAdaptor must not register as listener for PostAddToViewEvent in its constructor

Brian Leathem (JIRA) issues at jboss.org
Fri Jan 3 18:04:33 EST 2014


    [ https://issues.jboss.org/browse/RF-13452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12933674#comment-12933674 ] 

Brian Leathem edited comment on RF-13452 at 1/3/14 6:03 PM:
------------------------------------------------------------

This issue will take a fair amount of investigation to determine the effect of the system event listeners, and find alternatives.

https://github.com/richfaces/richfaces/blob/master/framework/src/main/java/org/richfaces/ui/iteration/UIDataAdaptor.java#L1434
                
      was (Author: bleathem):
    This issue will take a fair amount of investigation to determine the effect of the system event listeners, and find alternatives.
                  
> 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
>         Environment: Mojarra 2.1.?? - 2.1.26
>            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.plugin.system.issuetabpanels:all-tabpanel ),
> 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


More information about the richfaces-issues mailing list