You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Claude Brisson (JIRA)" <ji...@apache.org> on 2018/10/07 15:17:00 UTC

[jira] [Resolved] (VELOCITY-900) Velocity.evalute thows an exception if the next char after a keyword is '_'

     [ https://issues.apache.org/jira/browse/VELOCITY-900?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claude Brisson resolved VELOCITY-900.
-------------------------------------
    Resolution: Not A Bug
      Assignee: Claude Brisson

Since '_' can be part of a macro name, you could, how strange it may sound, have a directive named:

{{#end__}}

To solve your problem, you have to use the formal syntax:

{{#{end}__}}



> Velocity.evalute thows an exception if the next char after a keyword is '_'
> ---------------------------------------------------------------------------
>
>                 Key: VELOCITY-900
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-900
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.0
>         Environment: Win 7, Java 8
>            Reporter: Alto
>            Assignee: Claude Brisson
>            Priority: Major
>
> If I try to evalute the folling template "CONSTRAINT DF_#if(${archiveTableTemplate})${archiveTableTemplate}#else${table}#end__${column}" an exception is thrown.
> Velocity.evaluate(myContext, myStringWriter, "LOG", template); = >Exception occurred in target VM: Encountered "<EOF>" at LOG[line 1, column 93]
> Was expecting one of:
>     "(" ...
>     ")" ...
>     <ESCAPE_DIRECTIVE> ...
>     "]]#" ...
>     <WHITESPACE> ...
>     <NEWLINE> ...
>     <SUFFIX> ...
>     <STRING_LITERAL> ...
>     <INTEGER_LITERAL> ...
>     <FLOATING_POINT_LITERAL> ...
>     <DOT> ...
>     "{" ...
>     "}" ...
>     "\\\\" ...
>     "\\" ...
>     <TEXT> ...
>     <INLINE_TEXT> ...
>     <EMPTY_INDEX> ...
>     "{" ...
>     <
> If I use the Template "CONSTRAINT DF_#if(${archiveTableTemplate})${archiveTableTemplate}#else${table}#end __${column}" it works, but the result is wrong. Blank after replacement.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org