Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-200

Document ending with a Velocity comment and no carriage return throws an exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.840
    • Fix Version/s: 1.0 B1
    • Component/s: Velocity
    • Labels:
      None
    • keywords:
      velocity comment eof exception carriage return end
    • Similar issues:

      Description

      A document ending with the line:
      ##set($hello="hello")
      or any other velocity comment with no carriage return at the end of the line dumps a stacktrace on preview or save:

      Error number 4001 in 4: Error while parsing velocity page Play.robinf
      Wrapped Exception: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1, column 22. Encountered: <EOF> after : ""
      com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while parsing velocity page Play.robinf
      Wrapped Exception: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1, column 22. Encountered: <EOF> after : ""
      at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:131)
      at com.xpn.xwiki.render.XWikiVelocityRenderer.render(XWikiVelocityRenderer.java:87)
      at com.xpn.xwiki.render.XWikiRenderingEngine.renderText(XWikiRenderingEngine.java:116)
      at com.xpn.xwiki.render.XWikiRenderingEngine.renderText(XWikiRenderingEngine.java:93)
      at com.xpn.xwiki.render.XWikiRenderingEngine.renderDocument(XWikiRenderingEngine.java:85)
      at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:220)
      at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:151)
      at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
      at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
      at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
      at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
      at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:223)
      at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:125)
      at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:806)
      at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:87)
      at com.xpn.xwiki.web.ViewEditAction.execute(ViewEditAction.java:219)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:127)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)

      Wrapped Exception:

      org.apache.velocity.exception.ParseErrorException: Lexical error: org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at line 1, column 22. Encountered: <EOF> after : "" at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:193) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:125) at com.xpn.xwiki.render.XWikiVelocityRenderer.render(XWikiVelocityRenderer.java:87) at com.xpn.xwiki.render.XWikiRenderingEngine.renderText(XWikiRenderingEngine.java:116) at com.xpn.xwiki.render.XWikiRenderingEngine.renderText(XWikiRenderingEngine.java:93) at com.xpn.xwiki.render.XWikiRenderingEngine.renderDocument(XWikiRenderingEngine.java:85) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:220) at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:151) at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175) at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:223) at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:125) at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:806) at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:87) at com.xpn.xwiki.web.ViewEditAction.execute(ViewEditAction.java:219) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:127) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source)

        Attachments

          Activity

            People

            • Assignee:
              chungnv Nguyen Viet Chung
              Reporter:
              rewbs Robin Fernandes
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: