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

        Peter Romianowski created issue -
        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.
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 33669 12315229
        Will Glass-Husain made changes -
        Fix Version/s 1.5 [ 12310253 ]
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Bugzilla Id 33669
        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.
        #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.
        Environment Operating System: Windows XP
        Platform: PC
        Operating System: Windows XP
        Platform: PC
        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).
        Will Glass-Husain made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        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.
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12325234 ] Default workflow, editable Closed status [ 12551772 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551772 ] jira [ 12552598 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        210d 15h 44m 1 Will Glass-Husain 20/Sep/05 16:02
        Resolved Resolved Closed Closed
        533d 9h 1m 1 Henning Schmiedehausen 08/Mar/07 00:04

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development