api/src/main/java/jakarta/faces/event/MethodExpressionActionListener.java [78:173]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                methodExpressionOneArg.invoke(getElContext(), params);
            }
            catch (MethodNotFoundException mnfe)
            {
                // call to the zero argument MethodExpression
                methodExpressionZeroArg.invoke(getElContext(), EMPTY_PARAMS);
            }
        }
        catch (ELException e)
        {
            // "... If that fails for any reason, throw an AbortProcessingException,
            // including the cause of the failure ..."
            // -= Leonardo Uribe =- after discussing this topic on MYFACES-3199, the conclusion is the part is an advice
            // for the developer implementing a listener in a method expressions that could be wrapped by this class.
            // The spec wording is poor but, to keep this coherently with ExceptionHandler API,
            // the spec and code on UIViewRoot we need:
            // 2a) "exception is instance of APE or any of the causes of the exception are an APE, 
            // DON'T publish ExceptionQueuedEvent and terminate processing for current event".
            // 2b) for any other exception publish ExceptionQueuedEvent and continue broadcast processing.
            Throwable cause = e.getCause();
            AbortProcessingException ape = null;
            if (cause != null)
            {
                do
                {
                    if (cause instanceof AbortProcessingException exception)
                    {
                        ape = exception;
                        break;
                    }
                    cause = cause.getCause();
                }
                while (cause != null);
            }
            
            if (ape != null)
            {
                // 2a) "exception is instance of APE or any of the causes of the exception are an APE, 
                // DON'T publish ExceptionQueuedEvent and terminate processing for current event".
                // To do this throw an AbortProcessingException here, later on UIViewRoot.broadcastAll,
                // this exception will be received and stored to handle later.
                throw ape;
            }
            throw e;
        }
    }
    
    @Override
    public void restoreState(FacesContext context, Object state)
    {
        methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
        methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];
    }

    @Override
    public Object saveState(FacesContext context)
    {
        return new Object[] {methodExpressionOneArg, methodExpressionZeroArg};
    }

    @Override
    public void setTransient(boolean newTransientValue)
    {
        isTransient = newTransientValue;
    }

    @Override
    public boolean isTransient()
    {
        return isTransient;
    }
    
    private ELContext getElContext()
    {
        return getFacesContext().getELContext();
    }
    
    private FacesContext getFacesContext()
    {
        return FacesContext.getCurrentInstance();
    }
    
    /**
     * Creates a {@link MethodExpression} with no params and with the same Expression as 
     * param <code>methodExpression</code>
     * <b>WARNING!</b> This method creates new {@link MethodExpression} with expressionFactory.createMethodExpression.
     * That means is not decorating MethodExpression passed as parameter -
     * support for EL VariableMapper will not be available!
     * This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details).
     */
    private void _createZeroArgsMethodExpression(MethodExpression methodExpression)
    {
        ExpressionFactory expressionFactory = getFacesContext().getApplication().getExpressionFactory();

        this.methodExpressionZeroArg = expressionFactory.createMethodExpression(getElContext(), 
                  methodExpression.getExpressionString(), Void.class, EMPTY_CLASS_ARRAY);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



api/src/main/java/jakarta/faces/event/MethodExpressionValueChangeListener.java [77:173]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                methodExpressionOneArg.invoke(getElContext(), params);
            }
            catch (MethodNotFoundException mnfe)
            {
                // call to the zero argument MethodExpression
                methodExpressionZeroArg.invoke(getElContext(), EMPTY_PARAMS);
            }
        }
        catch (ELException e)
        {
            // "... If that fails for any reason, throw an AbortProcessingException,
            // including the cause of the failure ..."
            // -= Leonardo Uribe =- after discussing this topic on MYFACES-3199, the conclusion is the part is an advice
            // for the developer implementing a listener in a method expressions that could be wrapped by this class.
            // The spec wording is poor but, to keep this coherently with ExceptionHandler API,
            // the spec and code on UIViewRoot we need:
            // 2a) "exception is instance of APE or any of the causes of the exception are an APE, 
            // DON'T publish ExceptionQueuedEvent and terminate processing for current event".
            // 2b) for any other exception publish ExceptionQueuedEvent and continue broadcast processing.
            Throwable cause = e.getCause();
            AbortProcessingException ape = null;
            if (cause != null)
            {
                do
                {
                    if (cause instanceof AbortProcessingException exception)
                    {
                        ape = exception;
                        break;
                    }
                    cause = cause.getCause();
                }
                while (cause != null);
            }
            
            if (ape != null)
            {
                // 2a) "exception is instance of APE or any of the causes of the exception are an APE, 
                // DON'T publish ExceptionQueuedEvent and terminate processing for current event".
                // To do this throw an AbortProcessingException here, later on UIViewRoot.broadcastAll,
                // this exception will be received and stored to handle later.
                throw ape;
            }
            //for any other exception publish ExceptionQueuedEvent and continue broadcast processing.
            throw e;
        }
    }

    @Override
    public void restoreState(FacesContext context, Object state)
    {
        methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
        methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];
    }

    @Override
    public Object saveState(FacesContext context)
    {
        return new Object[] {methodExpressionOneArg, methodExpressionZeroArg};
    }

    @Override
    public void setTransient(boolean newTransientValue)
    {
        isTransient = newTransientValue;
    }

    @Override
    public boolean isTransient()
    {
        return isTransient;
    }
    
    private ELContext getElContext()
    {
        return getFacesContext().getELContext();
    }
    
    private FacesContext getFacesContext()
    {
        return FacesContext.getCurrentInstance();
    }
    
    /**
     * Creates a {@link MethodExpression} with no params and with the same Expression as 
     * param <code>methodExpression</code>
     * <b>WARNING!</b> This method creates new {@link MethodExpression} with expressionFactory.createMethodExpression.
     * That means is not decorating MethodExpression passed as parameter -
     * support for EL VariableMapper will not be available!
     * This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details).
     */
    private void _createZeroArgsMethodExpression(MethodExpression methodExpression)
    {
        ExpressionFactory expressionFactory = getFacesContext().getApplication().getExpressionFactory();

        this.methodExpressionZeroArg = expressionFactory.createMethodExpression(getElContext(), 
                  methodExpression.getExpressionString(), Void.class, EMPTY_CLASS_ARRAY);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



