Velocity
  1. Velocity
  2. VELOCITY-272

EOF exception when last line is commented out and has no new line at end

    Details

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

      Description

      So if this is the last line of a template:

        1. something....<EOF>

      Then we'll get an exception:

      org.apache.velocity.exception.ParseErrorException: Lexical error:
      org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 8,
      column 110. Encountered: <EOF> after : ""
      at org.apache.velocity.Template.process(Template.java:181)
      at
      org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:466)
      at
      org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:384)
      at
      org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:814)
      at org.apache.velocity.runtime.directive.Parse.render(Parse.java:196)
      at
      org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:153)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
      at
      org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:109)
      at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)

        Issue Links

          Activity

          Hide
          Will Glass-Husain added a comment -

          can you please open a separate issue and attach a copy of the template? You can mark it as "related to" VELOCITY-272 (this issue).

          Show
          Will Glass-Husain added a comment - can you please open a separate issue and attach a copy of the template? You can mark it as "related to" VELOCITY-272 (this issue).
          Hide
          Jean Seurin added a comment -

          I suddenly receive a similar exception:
          org.apache.velocity.exception.ParseErrorException: Encountered "<EOF>" at...

          I can add ## at the end of the file, or several blank lines, nothing works. It's very odd that it just stopped working, everything went really smoothly. Nothing significantly changed before and and after the exception occurred.

          Does this belongs to the current issue? Is it worth reopening?

          Show
          Jean Seurin added a comment - I suddenly receive a similar exception: org.apache.velocity.exception.ParseErrorException: Encountered "<EOF>" at... I can add ## at the end of the file, or several blank lines, nothing works. It's very odd that it just stopped working, everything went really smoothly. Nothing significantly changed before and and after the exception occurred. Does this belongs to the current issue? Is it worth reopening?
          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.
          Hide
          Will Glass-Husain added a comment -

          Fixed this nastly little bug in upcoming release 1.5. Thanks for reporting it.

          Show
          Will Glass-Husain added a comment - Fixed this nastly little bug in upcoming release 1.5. Thanks for reporting it.
          Hide
          Will Glass-Husain added a comment -

          thanks for reporting this. we'll address this in upcoming 1.5

          Show
          Will Glass-Husain added a comment - thanks for reporting this. we'll address this in upcoming 1.5
          Hide
          Mike Kienenberger added a comment -

          If you leave the "something" part off and just end a template with "##", you'll
          get a similar error. ie, "something....##<EOF>" causes the same problem.
          Velocity 1.3.1.

          Show
          Mike Kienenberger added a comment - If you leave the "something" part off and just end a template with "##", you'll get a similar error. ie, "something....##<EOF>" causes the same problem. Velocity 1.3.1.

            People

            • Assignee:
              Unassigned
              Reporter:
              Zoltan Luspai
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development