[ https://issues.apache.org/jira/browse/VELOCITY-683?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claude Brisson resolved VELOCITY-683. ------------------------------------- Resolution: Fixed Assignee: Claude Brisson Fix Version/s: 2.x Fixed by the patch from VELOCITY-841 (commit 1753788). > When passing literals other than strings to macro calls, setting new values > the formal parameters does not propagate the changes outside the local scope > -------------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: VELOCITY-683 > URL: https://issues.apache.org/jira/browse/VELOCITY-683 > Project: Velocity > Issue Type: Bug > Components: Engine > Affects Versions: 1.5, 1.6, 1.6.1 > Reporter: Sergiu Dumitriu > Assignee: Claude Brisson > Priority: Minor > Fix For: 2.x > > > With this macro definition: > #macro(setValueToEmpty $value) > #set($value = '') > #end > While the following works well: > #set($value = 'abc') > #setValueToEmpty('abc') => $value == '' > this fails: > #set($value = 'abc') > #setValueToEmpty(3) => $value == 'abc' > This is caused by the fact that in > org.apache.velocity.context.ProxyVMContext#addVMProxyArg if the parameter is > a constant (which somehow doesn't include strings), then a local variable is > created with the node's value as its value. For string literals, the actual > node is placed in the proxy map, which allows setting a new value for it. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org