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.6.1, 1.6, 1.5 Reporter: Sergiu Dumitriu Priority: Minor 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 is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org