[
https://issues.apache.org/jira/browse/VELOCITY-874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15276095#comment-15276095
]
Claude Brisson edited comment on VELOCITY-874 at 5/9/16 8:18 AM:
-----------------------------------------------------------------
Duplicate of https://issues.apache.org/jira/browse/VELOCITY-542
was (Author: claude):
Duplicate of https://issues.apache.org/jira/browse/VELOCITY-873
> Subtraction doesn't work as expected
> ------------------------------------
>
> Key: VELOCITY-874
> URL: https://issues.apache.org/jira/browse/VELOCITY-874
> Project: Velocity
> Issue Type: Bug
> Environment: VTL in user macro in Atlassian Confluence 5.9.4
> Reporter: Alexander Rosenberg
>
> This works as expected:
> {noformat}
> ## @noparams
> #set ($n = 5)
> #set ($m = $n+1)
> <p>$m</p>
> {noformat}
> Output: {{<p>6</p>}}
> However, subtraction doesn't work:
> {noformat}
> ## @noparams
> #set ($n = 5)
> #set ($m = $n-1)
> <p>$m</p>
> {noformat}
> Output: {{<p>$m</p>}}
> From [SO Q&A
> #15448108|http://stackoverflow.com/questions/15448108/subtraction-is-not-working-with-velocity-template],
> it appears that this behavior is due to the parser treating the
> hyphen/dash/minus-sign as part of the identifier, but certainly an exception
> should be made for when the "identifier" ends with only digits and/or hyphens.
> Another case:
> {noformat}
> ## @noparams
> #set ($n = 5)
> #set ($m = $n- 1)
> <p>$m</p>
> {noformat}
> In this case we get an all too familiar {{ParseErrorException}}:
> {noformat}
> org.apache.velocity.exception.ParseErrorException: Encountered "1" at
> getRenderedContent[line 4, column 16]
> Was expecting one of:
> <RPAREN> ...
> "-" ...
> "+" ...
> "*" ...
> "/" ...
> "%" ...
> <LOGICAL_AND> ...
> <LOGICAL_OR> ...
> <LOGICAL_LT> ...
> <LOGICAL_LE> ...
> <LOGICAL_GT> ...
> <LOGICAL_GE> ...
> <LOGICAL_EQUALS> ...
> <LOGICAL_NOT_EQUALS> ...
> at
> org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1202)
> at
> org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1164)
> at
> org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:219)
> at
> com.atlassian.confluence.util.velocity.VelocityUtils.writeRenderedContent(VelocityUtils.java:148)
> at
> com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedContent(VelocityUtils.java:130)
> at
> com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedContent(VelocityUtils.java:117)
> at
> com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedContent(VelocityUtils.java:113)
> at
> com.atlassian.confluence.macro.GenericVelocityMacro.execute(GenericVelocityMacro.java:101)
> ~~~snipped~~~
> {noformat}
> This bug is related to (or possibly the same as) [bug
> 873|http://issues.apache.org/jira/browse/VELOCITY-873].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]