[ 
https://issues.apache.org/jira/browse/MYFACES-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027209#comment-13027209
 ] 

Leonardo Uribe commented on MYFACES-3119:
-----------------------------------------

I have attached the same project, but with the solution proposed 
(mf3119-fix-viewhandler.zip). In few words, you add a system event listener 
before UIViewRoot.markInitialState() is called. To prevent break PSS algorithm, 
you should do after vdl.buildView is called, or clearInitialState for 
UIViewRoot, so the state will be saved fully and can be restored correctly.

The problem is about "when" suscribe the listener. The right moment is after 
vdl.buildView is called, or you can use f:event to do the same. Really there 
are many ways to do what you want. 

Other alternative to solve this issue is just do not call 
UIViewRoot.markInitialState, just like Mojarra does, but since there are many 
valid ways to do it, I don't think this should be done on MyFaces.

MB >> How can the newly created instance be expected to have the same keyset as 
the previously saved map?

Because the base PSS hypothesis is the view will be the same always between 
request before markInitialState is called. If that hypothesis is not preserved, 
there is not warrant PSS will work.

> NullPointerException in 
> UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot 
> subscribed to PostAddToViewEvent
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3119
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3119
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 2.0.5
>            Reporter: Matt Benson
>            Assignee: Leonardo Uribe
>         Attachments: mf3119-fix-viewhandler.zip, mf3119.patch.txt, 
> mf3119.tar.gz, mf3119.tar.gz
>
>
> As reported in MYFACES-2466 (whose summary I copied here), I am encountering 
> the NPE on the access of holderList in what is currently line 1917 of 
> UIComponentBase whenever I use a ComponentSystemEventListener on UIViewRoot.  
> Specifically I am subscribing to PreRenderViewEvent and the problem occurs 
> restoring the view regardless of whether I unsubscribe the listener e.g. 
> after RENDER_RESPONSE.
> More information:
> _systemEventListenerClassMap is null when the method is called, thus the map 
> is reinstantiated so of course the value looked up and assigned to holderList 
> is null.
> Now I have to go use Mojarra until this is fixed.  :(

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to