Re: StackOverflowError when using ValueExpressionAnalayzer with nested CC on postback

From: manfred riem <>
Date: Thu, 22 Jan 2015 10:25:47 -0600

Hi Thomas,

As noted by Ed on the issue:

Ok, Manfred and I have looked at this and discussed it on the phone. One
concern we have is the timing of when your
ValueExpressionAnalyzer.getReference() is called. The original, package
private javax.faces.validator.ValueExpressionAnalyzer is only invoked
during the handling of BeanValidator.validate(). This is called during
the processValidations lifecycle phase. At this point in the lifecycle
all of the composite component retargeting and facelet inclusion has
already been done.

My question is, when do you actually need to call your getReference()?
One way to do it is to provide a top-level Java component for the
composite component and override one of the lifecycle methods instead of
using PostAddToViewEventListener. For example, if you need to do it
during page rendering, you could override encodeEnd(), call
super.encodeEnd() and then invoke your listener.

The most important thing to keep in mind is what is the state of the
tree when your getReference() is called?

On 1/21/15, 3:47 PM, Thomas Andraschko wrote:
> Hi,
> as requested on ticket
>, i'm here to discuss it.
> As i already said, our ValueExpressionAnalayzer in PrimeFaces, which
> is simliar to yours, works fine in all cases - out of one single case:
> A StackOverflow occurs on postback in a PostAddToViewEvent-listener
> with nested CCs.
> It works fine in ALL other cases i ever used it.
> PrimeFaces needs to get the original ValueExpression to get e.g. the
> BeanValidation constraints.
> I'm sure i must not explain the logic of the ValueExpressionAnalyzer
> as it's almost the same like yours.
> I assume, when the PostAddToView-event is called for the inputtext
> component, the parent composite components are already ready, so it
> should be possible to execute the ValueExpressionAnalyzer without
> leading in a StackOverflow on postback.
> Feel free to ask me any questions about it.
> Regards,
> Thomas