[
https://issues.apache.org/jira/browse/VELOCITY-681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666381#action_12666381
]
Sergiu Dumitriu commented on VELOCITY-681:
------------------------------------------
Provided a fix, which doesn't break any of the existing tests.
The behavior of org.apache.velocity.context.ProxyVMContext#put was changed to
match the following behavior:
- If this is a valid proxy to a variable, set the value of the proxied
variable; otherwise:
- If a local scope is enforced, set a local variable; otherwise:
- If this is a local variable, set a local variable; otherwise:
- If this is a proxy to a literal, set a local literal variable, and a global
variable; otherwise:
- Set a global variable (where global means the parent context)
Also, #get was changed to take into account local literal variables.
Local literal variable means a context parameter with the key
".literal.$varName", which was already used in #addVMProxyArg.
> [regression] Changes on the macro parameters are not persisted outside the
> macro call
> -------------------------------------------------------------------------------------
>
> Key: VELOCITY-681
> URL: https://issues.apache.org/jira/browse/VELOCITY-681
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.6.1
> Reporter: Sergiu Dumitriu
> Priority: Critical
> Fix For: 1.6.2, 1.7
>
> Attachments: VELOCITY-681-1.6.patch, VELOCITY-681-trunk.patch
>
>
> The fix for VELOCITY-615 was too radical, since it completely disables
> #setting new values to the formal arguments. A minimalistic example that used
> to work up until 1.6 is:
> {noformat}
> #macro(myMacro $result)
> #set($result = 'some value')
> #end
> #myMacro($x)
> $x
> {/noformat}
> which prints $x (as an undefined variable).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]