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

Empty gallery macro throws error in HTML and PDF export

XMLWordPrintable

      Steps to reproduce:

      1. Create a page with a gallery macro:
        {gallery}
      2. Do not attach any images to the page
      3. Export the page to PDF or HTML via Space Admin->Advanced->Export Space. Please note that the problem does not exist if you export the page to PDF through the "Tools->Export to PDF" menu

      The HTML or PDF page will contain an error message:

      Error trying to draw image gallery org.apache.velocity.exception.MethodInvocationException: Invocation of method 'requireResource' in class $Proxy48 threw exception java.lang.NullPointerException @ /com/atlassian/confluence/plugins/macros/advanced/gallery-default.vm[1,25]

      In Confluence version prior to 2.9, a nice message is presented to the user instead:

      There are no images attached to this page

      The following stack trace recorded in the log during the export:

      2009-02-04 18:25:15,531 ERROR [Export Space task] [plugins.macros.advanced.GalleryMacro] execute Error while trying to draw the image gallery
      – url: /confluence/spaces/doexportspace.action | userName: admin | referer: http://localhost:8100/confluence/spaces/exportspace.action?key=~admin | action: doexportspace
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'requireResource' in class $Proxy48 threw exception java.lang.NullPointerException @ /com/atlassian/confluence/plugins/macros/advanced/gallery-default.vm[1,25]
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
      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.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:194)
      at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
      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.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:58)
      at com.atlassian.confluence.plugins.macros.advanced.GalleryMacro.execute(GalleryMacro.java:100)
      at com.atlassian.renderer.v2.macro.ResourceAwareMacroDecorator.execute(ResourceAwareMacroDecorator.java:45)
      at com.atlassian.renderer.v2.components.MacroRendererComponent.executeMacro(MacroRendererComponent.java:196)
      at com.atlassian.renderer.v2.components.MacroRendererComponent.processMacro(MacroRendererComponent.java:154)
      at com.atlassian.renderer.v2.components.MacroRendererComponent.makeMacro(MacroRendererComponent.java:58)
      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:114)
      at com.atlassian.renderer.v2.WikiMarkupParser.handlePotentialMacro(WikiMarkupParser.java:99)
      at com.atlassian.renderer.v2.WikiMarkupParser.parse(WikiMarkupParser.java:60)
      at com.atlassian.renderer.v2.components.MacroRendererComponent.render(MacroRendererComponent.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.GeneratedMethodAccessor329.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      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 $Proxy55.convertWikiToXHtml(Unknown Source)
      at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXHtml(WikiExporter.java:124)
      at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXHtml(WikiExporter.java:82)
      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:597)
      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:179)
      at com.atlassian.confluence.importexport.impl.HtmlExporter.exportPage(HtmlExporter.java:87)
      at com.atlassian.confluence.importexport.impl.HtmlExporter.exportSpace(HtmlExporter.java:99)
      at com.atlassian.confluence.importexport.impl.AbstractRendererExporterImpl.doExport(AbstractRendererExporterImpl.java:86)
      at com.atlassian.confluence.importexport.impl.HtmlExporter.doExport(HtmlExporter.java:31)
      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:597)
      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 $Proxy68.exportAs(Unknown Source)
      at com.atlassian.confluence.importexport.actions.ExportSpaceLongRunningTask$1.doInTransactionWithoutResult(ExportSpaceLongRunningTask.java:88)
      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:59)
      at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
      at com.atlassian.plugin.webresource.WebResourceManagerImpl.getIncludeMode(WebResourceManagerImpl.java:261)
      at com.atlassian.plugin.webresource.WebResourceManagerImpl.requireResource(WebResourceManagerImpl.java:58)
      at com.atlassian.confluence.plugin.webresource.DefaultConfluenceWebResourceManager.requireResource(DefaultConfluenceWebResourceManager.java:49)
      at sun.reflect.GeneratedMethodAccessor233.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      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 $Proxy48.requireResource(Unknown Source)
      at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:295)
      at com.atlassian.confluence.velocity.introspection.UnboxingMethod.invoke(UnboxingMethod.java:29)
      at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
      ... 72 more

              alynch Andrew Lynch (Inactive)
              zyap Zed Yap [Atlassian]
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: