On 31/08/2012 12:37, Konstantin Kolinko wrote: > 2012/8/30 <ma...@apache.org>: >> Author: markt >> Date: Thu Aug 30 19:44:46 2012 >> New Revision: 1379091 >> >> URL: http://svn.apache.org/viewvc?rev=1379091&view=rev >> Log: >> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53792 >> Support method expressions that include a method call that is not at the end >> of the expression >> >> Modified: >> tomcat/tc7.0.x/trunk/ (props changed) >> tomcat/tc7.0.x/trunk/java/org/apache/el/parser/AstValue.java >> tomcat/tc7.0.x/trunk/test/org/apache/el/TestMethodExpressionImpl.java >> >> Propchange: tomcat/tc7.0.x/trunk/ >> ------------------------------------------------------------------------------ >> Merged /tomcat/trunk:r1379090 >> >> Modified: tomcat/tc7.0.x/trunk/java/org/apache/el/parser/AstValue.java >> URL: >> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/el/parser/AstValue.java?rev=1379091&r1=1379090&r2=1379091&view=diff >> ============================================================================== >> --- tomcat/tc7.0.x/trunk/java/org/apache/el/parser/AstValue.java (original) >> +++ tomcat/tc7.0.x/trunk/java/org/apache/el/parser/AstValue.java Thu Aug 30 >> 19:44:46 2012 >> @@ -103,39 +103,52 @@ public final class AstValue extends Simp >> Object property = null; >> int propCount = this.jjtGetNumChildren(); >> >> - if (propCount > 2 && >> - this.jjtGetChild(propCount - 1) instanceof >> AstMethodParameters) { >> - // Method call with paramaters. >> - propCount-=2; >> - } else { >> - propCount--; >> - } >> int i = 1; >> - >> - // evaluate any properties before our target >> + // Evaluate any properties or methods before our target >> ELResolver resolver = ctx.getELResolver(); >> - if (propCount > 1) { >> - while (base != null && i < propCount) { >> - property = this.children[i].getValue(ctx); >> + while (i < propCount) { >> + if (i + 2 < propCount && >> + this.children[i + 1] instanceof AstMethodParameters) { >> + // Method call not at end of expression >> + base = resolver.invoke(ctx, base, >> + this.children[i].getValue(ctx), null, >> + ((AstMethodParameters) >> + this.children[i + 1]).getParameters(ctx)); >> + i += 2; >> + } else if (i + 2 == propCount && >> + this.children[i + 1] instanceof AstMethodParameters) { >> + // Method call at end of expression >> ctx.setPropertyResolved(false); > > The above was previously called before calling resolver.getValue(), > but now it is not called neither before resolver.invoke(), nor before > resolver.getValue().
The calls are unnecessary. The CompositeELResolver sets the property to false at the start of both of those methods and the Resolver implementations are responsible for setting it if they find a match. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org