[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Matt Benson (JIRA)

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

Matt Benson commented on MYFACES-3119:
--

Actually Jakob's ugly fix patch was not granted license for inclusion.  
Realistically his committership + CLA are probably enough however.

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Mark Struberg (JIRA)

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

Mark Struberg commented on MYFACES-3119:


heh, that's a pretty safe bet ;) The question is more if Jakob and Leo (the 2 
who did the most in this area) have any technical arguments against this patch.

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Matt Benson (JIRA)

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

Matt Benson commented on MYFACES-3119:
--

That's very possible, as Jakob himself called it an ugly patch.  Without 
being very familiar with the code, I just applied the patch that was available 
to see if it worked for me.

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Jakob Korherr (JIRA)

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

Jakob Korherr commented on MYFACES-3119:


hehe, yes sorry. I guess I just forgot to select Grant license... at that 
time, but yeah I am an Apache committer anyway!

huh, ja. I called it an ugly patch, because it was a first idea of how this 
could be solved and it was not done very thoroughly. I will look at it again 
now!

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Jakob Korherr (JIRA)

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

Jakob Korherr commented on MYFACES-3119:


@Leonardo: I think you did the most work in this area. Can you help us out here?

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Leonardo Uribe (JIRA)

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

Leonardo Uribe commented on MYFACES-3119:
-

Thanks Matt for the demo, it helps a lot to understand what's going on.

Surprisingly the code on MyFaces is correct. The problem is not something 
related to the implementation. So why Mojarra can do it and MyFaces cannot?

In JSF 2.0, Partial State Saving (PSS) was introduced based on this hypothesis 
(extracted from What's New in JSF 2.0 article by Andy Schwartz):

... JSF 2.0 addresses these issues with the introduction of a new “partial” 
state saving mechanism. This solution was inspired by a proposal that Adam 
Winer made (and implemented in Apache Trinidad) over 3 years ago. The key 
concept is that saving the entire state of the component tree is redundant, 
since the component tree can always be restored to its initial state by 
re-executing the view (ie. by re-executing Facelet handlers to re-create the 
component tree).

If we use the view definition to restore the component tree to its initial 
state, then the only state that needs to be saved is state that has been 
modified since the view was initially created. And since in most cases the 
number of components that are modified after component tree creation is small, 
the size of this delta state is typically much smaller than the full component 
tree state. ...

If you execute some code that affects the state of a component before 
markInitialState() methods and don't do the same when the view is built on 
restore view phase, exceptions like the one described here will happen. 

The example here tries to add a listener before render response phase, but note 
in render response phase happens these important steps:

1. vdl.buildView
2. publish PreRenderViewEvent
3. viewHandler.renderView

On the first one, all view is marked, calling markInitialState. In few words, 
this means that all subsequent changes will be considered delta data and 
should be saved on the state. The difference between MyFaces and Mojarra is 
that Mojarra does not call markInitialState over UIViewRoot instance, but 
MyFaces does. I notice it doing some tests for PSS long time ago. Note to get 
the minimal possible state, it is adviced to call markInitialState over 
UIViewRoot, like MyFaces does.

So what are the possible solutions to this issue:

1. Create a custom class extending from ViewHandlerWrapper that do this:

public void renderView(FacesContext context, UIViewRoot viewToRender)
throws IOException, FacesException
{
viewToRender.clearInitialState();
super.renderView(context, viewToRender);
}

  This is my preferred option, because it will work with both JSF 
implementations and is easy to do.

2. Use PreRenderViewEvent instead a PhaseListener.

3. Add the code on the custom ViewHandlerWrapper renderView method before call 
the delegate one.

I'll close this issue as not a problem. Interesting issue.

 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
 Attachments: 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Matt Benson (JIRA)

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

Matt Benson commented on MYFACES-3119:
--

Leo: thanks for the response.  I am not clear on your solution, however.  Note 
that the PhaseListener is only used to apply the ComponentSystemEventListener 
to the view, so in my opinion I *am* using a PreRenderViewEvent instead of a 
PhaseListener.  Is it your contention that the subscribe/unsubscribe parts of 
the UIComponent(Base) API should *not* be used directly by Java code?  That 
seems wrong to me.  Without getting too deep into partial state and delta 
changes, with which I am yet not so familiar, my comprehension of the 
*immediate* cause of the NPE is that the method in question:

* checks instance variable _systemEventListenerClassMap, creating a new 
instance if null
* assumes that the map will contain a non-null value for every key in the 
passed-in map

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

 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.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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Leonardo Uribe (JIRA)

[ 
https://issues.apache.org/jira/browse/MYFACES-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-29 Thread Matt Benson (JIRA)

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

Matt Benson commented on MYFACES-3119:
--

Leo:  Thanks for your patient explanation.  I am beginning to understand it.  
However, I would then suggest that perhaps there might be a more graceful 
failure available rather than an unqualified NPE.  This would also help avoid 
users mistakenly thinking there is a bug.

 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


[jira] [Commented] (MYFACES-3119) NullPointerException in UIComponentBase.restoreDeltaSystemEventListenerClassMap() when UIViewRoot subscribed to PostAddToViewEvent

2011-04-28 Thread Leonardo Uribe (JIRA)

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

Leonardo Uribe commented on MYFACES-3119:
-

Could you provide more information about how to reproduce this issue? In that 
way, there are more changes this issue could be fixed soon. This type of issues 
are usually very difficult to reproduce, but very easy to solve as soon as you 
have a test case.

 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

 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