Velocity
  1. Velocity
  2. VELOCITY-359

#if(some expression)#end causes ParseException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      #if(...) #end works but #if(...)#end

      Stacktrace:

      org.apache.velocity.exception.ParseErrorException: Encountered "#en
      d\n" at line 61, column 44.
      Was expecting one of:
      "(" ...
      <RPAREN> ...
      <ESCAPE_DIRECTIVE> ...
      <SET_DIRECTIVE> ...
      "\\\\" ...
      "
      " ...
      <TEXT> ...
      <SINGLE_LINE_COMMENT> ...
      "*#" ...
      "*#" ...
      <STRING_LITERAL> ...
      "if" ...
      "stop" ...
      <NUMBER_LITERAL> ...
      <WORD> ...
      <DOT> ...
      "

      {" ... "}

      " ...
      <IDENTIFIER> ...

      If you wonder why we write such stupid statements: We use velocity inside a CMS
      where it is possible to leave texts blank inside an #if-block.

        Activity

        Hide
        Peter Romianowski added a comment -

        Workaround for us for now (attention: weird code ahead

        instead of using #if (...)#end we use #if (...)$!

        {someunusedvar}

        #end

        That works.

        Show
        Peter Romianowski added a comment - Workaround for us for now (attention: weird code ahead instead of using #if (...)#end we use #if (...)$! {someunusedvar} #end That works.
        Hide
        Will Glass-Husain added a comment -

        Thanks for the idea. Added to current source (1.5-dev).

        Show
        Will Glass-Husain added a comment - Thanks for the idea. Added to current source (1.5-dev).
        Hide
        Henning Schmiedehausen added a comment -

        Close all resolved issues for Engine 1.5 release.

        Show
        Henning Schmiedehausen added a comment - Close all resolved issues for Engine 1.5 release.

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Romianowski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development