Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
1.2, 1.3, 1.x, 1.4, 2.x
-
None
Description
The recurse method never returns when the vtl template contains a loop (should have been fixed in rev 321227):
RenderTool tool = new RenderTool();
VelocityContext ctx = new VelocityContext();
String vtl = "#set($foo = 'I am [$foo]') $foo";
System.out.println(tool.recurse(ctx, vtl));
[StackOverflow]
the issue is caused by a misplaced '++' operator in the internalRecurse method:
protected String internalRecurse(Context ctx, String vtl, int count) throws Exception
{
String result = eval(ctx, vtl);
if (result == null || result.equals(vtl))
else
{
// if we haven't reached our parse depth...
if (count < parseDepth)
else
{ // abort and return what we have so far //FIXME: notify the developer or user somehow?? return result; } }
}
The counter is updated after the recursive call returns, which never happens