[
https://issues.apache.org/jira/browse/VELOCITY-873?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claude Brisson resolved VELOCITY-873.
-------------------------------------
Resolution: Duplicate
Duplicate of https://issues.apache.org/jira/browse/VELOCITY-542
> Subtraction without spaces results in parse error
> -------------------------------------------------
>
> Key: VELOCITY-873
> URL: https://issues.apache.org/jira/browse/VELOCITY-873
> 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 ($list = ["a", "b", "c"])
> #set ($num = $list.size()+1)
> <p>$num</p>
> {noformat}
> However, changing it to subtraction results in a {{ParseErrorException}}:
> {noformat}
> ## @noparams
> #set ($list = ["a", "b", "c"])
> #set ($num = $list.size()-1)
> <p>$num</p>
> {noformat}
> The error message given in atlassian-confluence.log:
> {noformat}
> org.apache.velocity.exception.ParseErrorException: Encountered "-1" at
> getRenderedContent[line 4, column 26]
> Was expecting one of:
> <RPAREN> ...
> <WHITESPACE> ...
> "-" ...
> "+" ...
> "*" ...
> "/" ...
> "%" ...
> <LOGICAL_AND> ...
> <LOGICAL_OR> ...
> <LOGICAL_LT> ...
> <LOGICAL_LE> ...
> <LOGICAL_GT> ...
> <LOGICAL_GE> ...
> <LOGICAL_EQUALS> ...
> <LOGICAL_NOT_EQUALS> ...
> <DOT> ...
> 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 message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]