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

Guillaume Avril commented on MYFACES-4757:
------------------------------------------

Create a custom SystemEventListener with :

@override
public void processEvent(SystemEvent pEvent) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    
facesContext.getApplication().unsubscribeFromEvent(PreRenderComponentEvent.class,
 UIComponent.class, this);
}

Have it registered (like, when you click on a button, or something like this) 
with :

FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.getApplication().subscribeToEvent(PreRenderComponentEvent.class, 
UIComponent.class, new MyCustomSystemEventListener());



It should be enough to reproduce

> ApplicationImplEventManager.processGlobalListeners throws 
> ArrayIndexOutOfBound when a SystemEventListener unsubscribe itself during 
> processEvent
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4757
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4757
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: Guillaume Avril
>            Priority: Major
>
> When a SystemEventListener unsubscribe itself durint processEvent, the 
> ApplicationImplEventManager.processGlobalListeners throws an 
> ArrayIndexOutOfBound, because the eventInfos list size reduced by one, and 
> fail during the iteration by index.
>  
> To reproduce, just have a SystemEventListener that unsubscribes itself.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to