myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leonardo Uribe <lu4...@gmail.com>
Subject Re: StackOverflowError with MyFaces 2.2
Date Sun, 30 Mar 2014 21:44:54 GMT
Hi

I can see a change that was introduced in JSF 2.2. It has the
following description:

            // JSF 2.2 vdl.createComponent() requires special handling
to refresh
            // dynamic parts when refreshing is done. The only way to do it is
            // attaching a listener to PostRestoreStateEvent, so we
need to do this
            // invocation here.
            // Do it inside UIComponent.processEvent() is better
because in facelets
            // UILeaf we can skip this part just overriding the method.

In JSF 2.0 and 2.1, component listeners attached to
PostRestoreStateEvent do not receive the events, but in JSF 2.2 it was
added a code there that propagates PostRestoreStateEvent to the
listeners, because this fix is necessary to make
vdl.createComponent(...) to work. It seems we have a bug in the
component (not a MyFaces Bug), because the same component is
subscribed as a listener to PostRestoreStateEvent, which is not
necessary, because it always receive the event, it is already
subscribed by default.

Checking the base class, it shows something like this:

@ListenerFor(systemEventClass = PostRestoreStateEvent.class)
@ResourceDependency(library = "primefaces-extensions", name =
"primefaces-extensions.css")
public class MasterDetail extends UIComponentBase {

Of course, the @ListenerFor annotation is not necessary. But we could
make a simple check to avoid the exception ... Anyway this is
something to fix on primefaces, not here, so could you please reply
the answer to primefaces forum, so they can fix it?

regards,

Leonardo Uribe


2014-03-30 23:26 GMT+02:00 Oleg Varaksin <ovaraksin@googlemail.com>:
> By the way, it is a common pattern to call in a custom component e.g.
> super.processDecodes() in processDecodes() or super.processValidators() in
> processValidators(). This was always working before.
>
> Am 30.03.2014 23:23, schrieb Oleg Varaksin:
>
>> Hello MyFaces team,
>>
>> We get a StackOverflowError since MyFaces 2.x. The stack trace is shown
>> here http://forum.primefaces.org/viewtopic.php?f=14&t=36999
>>
>> The problem: Wenn we call super.processEvent(event) in the processEvent()
>> of a custom component, we get a recursion which ends in StackOverflowError.
>>
>> @Override
>> public void processEvent(ComponentSystemEvent event) throws
>> AbortProcessingException {
>>     super.processEvent(event);
>>     ...
>> }
>>
>> The call super.processEvent(event) is necessary because e.g. Mojarra
>> executes there some important code. But if we look at processEvent() in the
>> MyFaces' UIComponent, it iterates over all listeners for processEvent() and
>> invokes them. That means, processEvent() of the custom component is invoked
>> again. Does it work as designed or a is it a bug?
>>
>> It was working before MyFaces 2.x and it works for all Mojarra versions.
>>
>> Thanks in advance.
>> Oleg.
>
>

Mime
View raw message