myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <>
Subject [jira] [Created] (MYFACES-3877) Add @ListenerFor(systemEventClass = PostRestoreStateEvent.class) causes StackOverflowException on MyFaces 2.2
Date Mon, 31 Mar 2014 10:21:14 GMT
Leonardo Uribe created MYFACES-3877:

             Summary: Add @ListenerFor(systemEventClass = PostRestoreStateEvent.class) causes
StackOverflowException on MyFaces 2.2
                 Key: MYFACES-3877
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-344
    Affects Versions: 2.2.2
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe

>From MyFaces users list Oleg Varaksin:

Hello MyFaces team,

We get a StackOverflowError since MyFaces 2.x. The stack trace is shown here

The problem: Wenn we call super.processEvent(event) in the processEvent() of a custom component,
we get a recursion which ends in StackOverflowError.

public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {

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.

The problem was caused by this line:

@ListenerFor(systemEventClass = PostRestoreStateEvent.class)

The line is not necessary, because all components are already subscribed to the event by default.

The code we have in MyFaces is correct from spec perspective. See:

But a simple check in this part can help to avoid the exception and keep running code that
comes from 2.0/2.1. In fact, in 2.0/2.1 the offending line has no effect, but the problem
was caused because MyFaces handles the case. It is recommended to remove the offending line
from the users code anyway.

This message was sent by Atlassian JIRA

View raw message