opensubscriber
   Find in this group all groups
 
Unknown more information…

v : velocity-dev@jakarta.apache.org 7 November 2006 • 6:46AM -0500

[jira] Commented: (VELOCITY-285) reference within macro and foreach is incorrect
by Will Glass-Husain (JIRA)

REPLY TO AUTHOR
 
REPLY TO GROUP




    [ http://issues.apache.org/jira/browse/VELOCITY-285?page=comments#action_12447568 ]
            
Will Glass-Husain commented on VELOCITY-285:
--------------------------------------------

nice catch and nice fix!

sometimes it takes an alert user to find a subtle use case that exposes a more general underlying problem.



> reference within macro and foreach is incorrect
> -----------------------------------------------
>
>                 Key: VELOCITY-285
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-285
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.4
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Gilles Scokart
>         Assigned To: Henning Schmiedehausen
>            Priority: Minor
>             Fix For: 1.5
>
>
> It seems that there is a bug when we have loop into a recursive macro.
> Here is the test I run :
> #macro (test_loop $p)
> call to test_loop ($p)
> #foreach($child in $p)
>     in the loop the param should not be changed : ($p)
> #test_loop($child)
> #end
> return
> #end
> #set($l1=["a"])
> #set($l = [$l1])
> #test_loop($l)
> It produce:
> call to test_loop ([[a]])
> in the loop the param should not be changed : ([[a]])
> call to test_loop ([a])
> in the loop the param should not be changed : (a)
> call to test_loop (a)
> return
> return
> return
> IMHO, it should be
> call to test_loop ([[a]])
> in the loop the param should not be changed : ([[a]])
> call to test_loop ([a])
> in the loop the param should not be changed : ([a])
> call to test_loop (a)
> return
> return
> return
> The difference is in the second recusive call.  I don't know why, but it seems
> that the instruction #foreach($child in $p) has modified $p that contains the
> value of $child.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jaka...
For additional commands, e-mail: velocity-dev-help@jaka...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

opensubscriber is not affiliated with the authors of this message nor responsible for its content.