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

NPE in wiki macro execution when optional content and the macro uses {{wikimacrocontent/}}

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 15.3-rc-1
    • 15.2
    • Rendering
    • None
    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      To reproduce:

      • Add a wiki macro class xobject, just set an id (eg test) and name and use the following content
        {{velocity}}
        {{wikimacrocontent/}}
        {{/velocity}}
        
      • Use it without content:
        {{test/}}
      • Note: setting "optional content" explicitly also makes it fail with the NPE. When nothing is set, it defaults to "optional content".
      org.xwiki.rendering.macro.MacroExecutionException: Failed to execute wiki macro
       at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacro.execute(DefaultWikiMacro.java:112)
       at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacro.execute(DefaultWikiMacro.java:53)
       at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:309)
       at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
       at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:88)
       at org.xwiki.display.internal.DocumentContentAsyncExecutor.executeInCurrentExecutionContext(DocumentContentAsyncExecutor.java:395)
       at org.xwiki.display.internal.DocumentContentAsyncExecutor.execute(DocumentContentAsyncExecutor.java:268)
       at org.xwiki.display.internal.DocumentContentAsyncRenderer.execute(DocumentContentAsyncRenderer.java:112)
       at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
       at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:290)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
       at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
       at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:67)
       at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:43)
       at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96)
       at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39)
       at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:123)
       at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:52)
       at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68)
       at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42)
       at com.xpn.xwiki.doc.XWikiDocument.display(XWikiDocument.java:1352)
       at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1489)
       at com.xpn.xwiki.doc.XWikiDocument.displayDocument(XWikiDocument.java:1438)
       at com.xpn.xwiki.doc.XWikiDocument.displayDocument(XWikiDocument.java:1407)
       at com.xpn.xwiki.api.Document.displayDocument(Document.java:785)
       at jdk.internal.reflect.GeneratedMethodAccessor635.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
       at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
       at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
       at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
       at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:75)
       at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:242)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
       at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.xwiki.velocity.internal.directive.TryCatchDirective.render(TryCatchDirective.java:86)
       at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
       at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
       at org.apache.velocity.Template.merge(Template.java:358)
       at org.apache.velocity.Template.merge(Template.java:262)
       at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
       at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
       at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:222)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:177)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:138)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
       at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
       at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:843)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:805)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:792)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderNoException(InternalTemplateManager.java:747)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderNoException(InternalTemplateManager.java:739)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.renderNoException(DefaultTemplateManager.java:79)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.renderNoException(DefaultTemplateManager.java:73)
       at org.xwiki.template.script.TemplateScriptService.render(TemplateScriptService.java:54)
       at jdk.internal.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
       at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
       at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
       at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:492)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
       at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
       at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
       at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
       at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
       at org.apache.velocity.Template.merge(Template.java:358)
       at org.apache.velocity.Template.merge(Template.java:262)
       at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
       at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
       at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:222)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:177)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:138)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
       at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
       at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:843)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:805)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:792)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderNoException(InternalTemplateManager.java:747)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderNoException(InternalTemplateManager.java:739)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.renderNoException(DefaultTemplateManager.java:79)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.renderNoException(DefaultTemplateManager.java:73)
       at org.xwiki.template.script.TemplateScriptService.render(TemplateScriptService.java:54)
       at jdk.internal.reflect.GeneratedMethodAccessor167.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.base/java.lang.reflect.Method.invoke(Method.java:566)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
       at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
       at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
       at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
       at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:492)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:218)
       at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:331)
       at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:261)
       at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:171)
       at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
       at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
       at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:190)
       at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
       at org.apache.velocity.Template.merge(Template.java:358)
       at org.apache.velocity.Template.merge(Template.java:262)
       at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:280)
       at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:321)
       at com.xpn.xwiki.internal.template.VelocityTemplateEvaluator.evaluateContent(VelocityTemplateEvaluator.java:95)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.evaluateContent(TemplateAsyncRenderer.java:222)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.renderVelocity(TemplateAsyncRenderer.java:177)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:138)
       at com.xpn.xwiki.internal.template.TemplateAsyncRenderer.render(TemplateAsyncRenderer.java:54)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.lambda$syncRender$0(DefaultAsyncRendererExecutor.java:284)
       at com.xpn.xwiki.internal.security.authorization.DefaultAuthorExecutor.call(DefaultAuthorExecutor.java:98)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:284)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
       at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.render(DefaultBlockAsyncRendererExecutor.java:154)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:843)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:805)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.renderFromSkin(InternalTemplateManager.java:785)
       at com.xpn.xwiki.internal.template.InternalTemplateManager.render(InternalTemplateManager.java:771)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:91)
       at com.xpn.xwiki.internal.template.DefaultTemplateManager.render(DefaultTemplateManager.java:85)
       at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:2553)
       at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:180)
       at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:612)
       at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:300)
       at com.xpn.xwiki.web.LegacyActionServlet.service(LegacyActionServlet.java:112)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
       at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419)
       at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
       at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
       at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:122)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:61)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:63)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:132)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170)
       at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
       at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
       at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
       at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
       at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
       at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1383)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
       at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
       at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544)
       at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
       at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1305)
       at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
       at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
       at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
       at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
       at org.eclipse.jetty.server.Server.handle(Server.java:563)
       at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
       at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
       at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
       at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
       at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
       at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
       at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
       at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
       at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
       at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
       at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:139)
       at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
       at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:933)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1077)
       at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: org.xwiki.rendering.RenderingException: Failed to execute renderer
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:287)
       at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:267)
       at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
       at org.xwiki.rendering.wikimacro.internal.DefaultWikiMacro.execute(DefaultWikiMacro.java:110)
       ... 202 more
      Caused by: java.lang.NullPointerException
      

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: