Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-13771

HTML export results in NPE from requireResource velocimacro when used by plugins

XMLWordPrintable

      I have a macro plugin that renders a velocity template. The template contains #requireResource.

      When I export a page with this macro as HTML, the macro produces no output and I only see this error in the log:

      ERROR 2008-11-17 17:04:36,401 [Export Space task] DefaultExportEmbeddedResourceRenderer:renderResource - Unable to render resource
       -- url: /spaces/doexportspace.action | userName: admin | action: doexportspace
      java.lang.IllegalArgumentException: Cannot resolve external resource into attachment.
      	at com.atlassian.confluence.renderer.embedded.EmbeddedResourceUtils.resolveAttachment(EmbeddedResourceUtils.java:23)
      	at com.atlassian.confluence.importexport.impl.DefaultExportEmbeddedResourceRenderer.renderResource(DefaultExportEmbeddedResourceRenderer.java:43)
      	at com.atlassian.renderer.v2.components.EmbeddedRendererComponent.appendSubstitution(EmbeddedRendererComponent.java:51)
      	at com.atlassian.renderer.v2.components.AbstractRegexRendererComponent.regexRender(AbstractRegexRendererComponent.java:32)
      	at com.atlassian.renderer.v2.components.EmbeddedRendererComponent.render(EmbeddedRendererComponent.java:32)
      	at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53)
      	at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30)
      	at com.atlassian.renderer.v2.V2SubRenderer.render(V2SubRenderer.java:44)
      	at com.atlassian.renderer.v2.components.block.BlockRendererComponent.renderParagraph(BlockRendererComponent.java:97)
      	at com.atlassian.renderer.v2.components.block.BlockRendererComponent.render(BlockRendererComponent.java:43)
      	at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53)
      	at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30)
      	at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at $Proxy113.convertWikiToXHtml(Unknown Source)
      	at com.sun.wikis.plugin.expandmacro.ExpandMacro.execute(ExpandMacro.java:43)
      	at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45)
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:297)
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:255)
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:151)
      	at com.atlassian.renderer.v2.components.WikiContentRendererHandler.handleMacro(WikiContentRendererHandler.java:18)
      	at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:126)
      	at com.atlassian.renderer.v2.WikiMarkupParser.makeMacro(WikiMarkupParser.java:121)
      	at com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:94)
      	at com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60)
      	at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.java:47)
      	at com.atlassian.renderer.v2.V2Renderer.render(V2Renderer.java:53)
      	at com.atlassian.renderer.v2.plugin.PluggableV2Renderer.render(PluggableV2Renderer.java:30)
      	at com.atlassian.renderer.v2.V2RendererFacade.convertWikiToXHtml(V2RendererFacade.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at $Proxy113.convertWikiToXHtml(Unknown Source)
      	at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXHtml(WikiExporter.java:132)
      	at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXHtml(WikiExporter.java:90)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      	at com.atlassian.confluence.velocity.introspection.AnnotationBoxingMethod.invoke(AnnotationBoxingMethod.java:28)
      	at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:29)
      	at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      	at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
      	at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:294)
      	at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
      	at org.apache.velocity.Template.merge(Template.java:254)
      	at com.atlassian.confluence.util.TemplateSupport.processTemplate(TemplateSupport.java:71)
      	at com.atlassian.confluence.importexport.impl.HtmlExporter.doExportEntity(HtmlExporter.java:195)
      	at com.atlassian.confluence.importexport.impl.HtmlExporter.exportPage(HtmlExporter.java:107)
      	at com.atlassian.confluence.importexport.impl.HtmlExporter.exportSpace(HtmlExporter.java:120)
      	at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.doExport(AbstractRendererExporterImpl.java:89)
      	at com.atlassian.confluence.importexport.impl.HtmlExporter.doExport(HtmlExporter.java:46)
      	at com.atlassian.confluence.importexport.DefaultImportExportManager.exportAs(DefaultImportExportManager.java:112)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:585)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at $Proxy126.exportAs(Unknown Source)
      	at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:87)
      	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:127)
      	at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask.runInternal(ExportSpaceLongRunningTask.java:58)
      	at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21)
      	at java.lang.Thread.run(Thread.java:613)
      

      It appears that this bug is related or similar to to CONF-13551 and CONF-11540.

      A partial workaround is described in this comment.

              alynch Andrew Lynch (Inactive)
              15d9a6950818 Igor Minar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: