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

Failed to execute code macro with empty content

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.9, 2.0 M1
    • 1.9 M2, 1.8.4
    • {Unused} Rendering 2.0
    • None
    • any
    • empty code macro
    • Unit
    • Unknown

    Description

      XWiki 2.0 syntax:

      {{code}}{{/code}}
      

      Result is:

      Failed to execute macro: code
      

      With the following exception:

      org.xwiki.rendering.macro.MacroExecutionException: Failed to highlight content
      	at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:85)
      	at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:46)
      	at org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:148)
      	at org.xwiki.rendering.macro.box.AbstractBoxMacro.execute(AbstractBoxMacro.java:54)
      	at org.xwiki.rendering.internal.transformation.MacroTransformation.transformOnce(MacroTransformation.java:169)
      	at org.xwiki.rendering.internal.transformation.MacroTransformation.transform(MacroTransformation.java:113)
      	at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:72)
      	at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:5166)
      	at com.xpn.xwiki.doc.XWikiDocument.performSyntaxConversion(XWikiDocument.java:5139)
      	at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:531)
      	at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:450)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:616)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:108)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1611)
      	at com.xpn.xwiki.api.XWiki.parseTemplate(XWiki.java:655)
      	at sun.reflect.GeneratedMethodAccessor106.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:616)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:252)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:332)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)
      	at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)
      	at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
      	at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:191)
      	at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:156)
      	at com.xpn.xwiki.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:108)
      	at com.xpn.xwiki.XWiki.parseTemplate(XWiki.java:1611)
      	at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:124)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:226)
      	at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
      	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
      	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
      	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1124)
      	at com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:147)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      	at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:111)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      	at com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      	at com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      	at com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
      	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:361)
      	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
      	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
      	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:324)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:538)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)
      Caused by: Traceback (most recent call last):
        File "<string>", line 3, in <module>
        File "<string>", line 3, in <module>
        File "/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/__init__.py", line 180, in guess_lexer
        File "/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/util.py", line 110, in text_analyse
        File "/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/text.py", line 476, in analyse_text
      IndexError: index out of range: 0
      
      	at org.python.core.PyException.fillInStackTrace(PyException.java:70)
      	at java.lang.Throwable.<init>(Throwable.java:198)
      	at java.lang.Exception.<init>(Exception.java:46)
      	at java.lang.RuntimeException.<init>(RuntimeException.java:49)
      	at org.python.core.PyException.<init>(PyException.java:46)
      	at org.python.core.PyException.<init>(PyException.java:43)
      	at org.python.core.PyException.<init>(PyException.java:61)
      	at org.python.core.Py.IndexError(Py.java:210)
      	at org.python.core.SequenceIndexDelegate.checkIdxAndGetItem(SequenceIndexDelegate.java:63)
      	at org.python.core.PySequence.seq___getitem__(PySequence.java:305)
      	at org.python.core.PySequence.__getitem__(PySequence.java:301)
      	at pygments.lexers.text$py.analyse_text$16(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/text.py:483)
      	at pygments.lexers.text$py.call_function(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/text.py)
      	at org.python.core.PyTableCode.call(PyTableCode.java:165)
      	at org.python.core.PyBaseCode.call(PyBaseCode.java:131)
      	at org.python.core.PyFunction.__call__(PyFunction.java:317)
      	at pygments.util$py.text_analyse$9(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/util.py:113)
      	at pygments.util$py.call_function(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/util.py)
      	at org.python.core.PyTableCode.call(PyTableCode.java:165)
      	at org.python.core.PyBaseCode.call(PyBaseCode.java:131)
      	at org.python.core.PyFunction.__call__(PyFunction.java:317)
      	at pygments.lexers$py.guess_lexer$9(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/__init__.py:187)
      	at pygments.lexers$py.call_function(/home/marius/work/eclipse/enterprise/distribution/jetty/hsqldb/target/xwiki-enterprise-jetty-hsqldb-2.0-SNAPSHOT/webapps/xwiki/WEB-INF/lib/pygments-1.0-xwiki.jar/Lib/pygments/lexers/__init__.py)
      	at org.python.core.PyTableCode.call(PyTableCode.java:165)
      	at org.python.core.PyBaseCode.call(PyBaseCode.java:297)
      	at org.python.core.PyFunction.__call__(PyFunction.java:370)
      	at org.python.pycode._pyx16.f$0(<string>:5)
      	at org.python.pycode._pyx16.call_function(<string>)
      	at org.python.core.PyTableCode.call(PyTableCode.java:165)
      	at org.python.core.PyCode.call(PyCode.java:18)
      	at org.python.core.Py.runCode(Py.java:1192)
      	at org.python.core.Py.exec(Py.java:1236)
      	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:138)
      	at org.xwiki.rendering.internal.parser.pygments.PygmentsParser.highlight(PygmentsParser.java:183)
      	at org.xwiki.rendering.internal.macro.code.CodeMacro.highlight(CodeMacro.java:125)
      	at org.xwiki.rendering.internal.macro.code.CodeMacro.parseContent(CodeMacro.java:82)
      	... 84 more
      

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            mflorea Marius Dumitru Florea
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: