[ 
https://issues.apache.org/jira/browse/VELOCITY-947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17394787#comment-17394787
 ] 

Mike Kienenberger edited comment on VELOCITY-947 at 8/6/21, 2:00 PM:
---------------------------------------------------------------------

I'm pretty sure this is a matter of setting configuration parameters rather 
than a bug.   Let me know if ihat turns out not to be the case, and I'll reset 
the status it as "Won't fix" instead of "Not A Bug"


was (Author: mkienenb):
I'm pretty sure this is a matter of setting configuration parameters rather 
than a bug.   YLet me know if ihat turns out not to be the case, and I'll reset 
the status it as "Won't fix" instead of "Not A Bug"

> Input macro variable not changed outside scope
> ----------------------------------------------
>
>                 Key: VELOCITY-947
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-947
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.7.x
>            Reporter: Fabio Nascimento Brandão
>            Priority: Major
>         Attachments: variable_velocity.tar.gz
>
>
> I am migrating an application from Velocity Engine 1.5 to 1.7 (I am planning 
> to migrate to 2.x later) and I found a different behavior between 1.5, 1.6.x 
> and 1.7 versions.
> If you have this template:
> {code:java}
> #macro(testMacro $variable $newValue)
>       #set($variable = $newValue)
> #end
> #set($testevar = 'INCORRECT')
> Var before: $testevar
> #testMacro($testevar 'TEST OK')
> Var after: $testevar
> {code}
> The output for the versions 1.5, 1.6, 1.6.2, 1.6.3 and 1.6.4 are:
> {code:java}
> Var before: INCORRECT
> Var after: TEST OK
> {code}
> And for versions 1.6.1 and 1.7 are:
> {code:java}
> Var before: INCORRECT
> Var after: INCORRECT
> {code}
> In 1.5, the set inside macro was changing the referenced variable outside 
> macro's scope. In 1.6.1 and 1.7 the variable is not changed.
> I think this change was introduced by this issue:
>  https://issues.apache.org/jira/browse/VELOCITY-615
> In this method:
>  
> [https://github.com/apache/velocity-engine/commit/e0dec30ef0107ba0066fa18facdc1f7f2677087c#diff-79959d90eea878dd1d2550fa30aff8653a583339fe8125133b6a23573f2a0848L169-R173]
> Before the change, the context was updated with the key from getRootString() 
> method.
> I am attaching a project with the tests. You can change the velocity version 
> in _build.gradle_ and run with _./gradlew run_



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to