Issue Details (XML | Word | Printable)

Key: VELOCITY-108
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel Rall
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Velocity

Use of Velocimacro forward reference and/or recursion causes error messages

Created: 15/Oct/02 06:32 AM   Updated: 08/Mar/07 12:04 AM
Return to search
Component/s: Engine
Affects Version/s: 1.3-rc1
Fix Version/s: 1.5

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File TestVelocity.java 2004-09-22 09:18 PM Michael Abato 1 kB
Environment:
Operating System: All
Platform: All
Issue Links:
Duplicate
 

Bugzilla Id: 13623
Resolution Date: 29/Sep/05 08:43 AM


 Description  « Hide
I've confirmed that both forward referenced and recursed Velocimacros cause
error messages in 1.3-rc1 and 1.3.1-rc2 (I assume the intervening versions are
affected as well). I have not (yet) tested 1.4-dev.

The error message currently spouted by
org.apache.velocity.runtime.directive.VelocimacroProxy does not differentiate
between forward referencing and recursion (it is a very similar problem), and is
not representitive of the problem. It goes as follows:

  2002-10-14 16:03:49,562 - VM #linkIf: error : too few arguments to macro.
Wanted 3 got 0

This issue can be reproduced through either of the following setups:

a) Use the #linkIf macro in your VM_global_library.vm, then define it later on
in the file.

b) Define a #linkIf macro which calls itself recursively.

The expected behavior is that Velocity will either provide a more accurate
description of what it wants from the user, or allow forward referencing and
recursion without error messages. If not already in use, perhaps a multi-pass
approach to dealing with Velocimacro libraries should be put in place to
implement this.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
C. Daniel Mojoli B. added a comment - 29/Mar/03 11:54 PM
I am getting bit by this bug when trying to recurse to render a tree structure.

Does velocity in general support recursive VM calling (protecting a given
level's references from redefinition in other recursion levels)?

Michael Abato added a comment - 22/Sep/04 09:18 PM
Created an attachment (id=12833)
Simple test case illustrating this bug with trivial recursion

Nathan Bubna added a comment - 29/Sep/05 08:43 AM
This issue is a duplicate of http://issues.apache.org/jira/browse/VELOCITY-71 I'm resolving this one to give preference to the earlier report.

Henning Schmiedehausen added a comment - 08/Mar/07 12:04 AM
Close all resolved issues for Engine 1.5 release.