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

Space exports as PDF fail If the Code Block macro header contains [] or the Wiki Markup macro includes invalid hyperlinks

      Issue Summary

      Space exports as PDF fail (Normal Export or Custom Export) If the Code Block macro header contains [] or the Wiki Markup macro includes invalid hyperlinks: 

      Scenario 1

      If the Code Block macro header contains [] like the examples below:
      TEST [1]

      TEST [export]

      This is reproducible on Data Center: (yes) 

      Steps to Reproduce
      1. Create a new page.
      2. Add the Code Block Macro.
      3. Specify a header with [] like Test [export].
      4. Go to Space Tools>Exports>PDF.
      5. Choose either Normal Export or Custom Export by choosing only the newly created page that contains Code Block Macro.
      6. Click on Export.

      Scenario 2

      If the Wiki Markup macro is used and invalid hyperlinks are included within it:

      Steps to Reproduce
      1. Create a new page.
      2. Add the Wiki Markup Macro.
      3. Put the invalid hyperlink content in it similar like this:
        <ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c52f9a03-99fc-45aa-9414-f49dd8b9499c">
        ...
        [*Test Link*|This is invalid link]
        ...
        </ac:structured-macro>
        
      4. Go to Space Tools>Exports>PDF.
      5. Choose either Normal Export or Custom Export by choosing only the newly created page that contains Wiki Markup Macro.
      6. Click on Export.

      Expected Results

      Space export as PDF should be successful. 

      Actual Results

      The below exception is thrown in the atlassian-confluence.log file:

      2024-07-09 08:28:08,558 ERROR [Long running task: PDF Space Export] [atlassian.renderer.v2.V2Renderer] render Unable to render content due to system error: Cannot invoke \"javax.servlet.http.HttpServletRequest.getSession()\" because \"request\" is null
       -- url: /confluence/spaces/flyingpdf/doflyingpdf.action | userName: admin | action: doflyingpdf | referer: https://linux-75238.prod.atl-cd.net/confluence/spaces/flyingpdf/flyingpdf.action?key=TEST | traceId: 4606c73a6e700c70
      java.lang.NullPointerException: Cannot invoke "javax.servlet.http.HttpServletRequest.getSession()" because "request" is null
          at com.atlassian.xwork.SimpleXsrfTokenGenerator.getToken(SimpleXsrfTokenGenerator.java:20)
          at com.atlassian.confluence.links.linktypes.PageCreateLink.makeCreatePage(PageCreateLink.java:46)
          at com.atlassian.confluence.links.linktypes.PageCreateLink.<init>(PageCreateLink.java:30)
          at com.atlassian.confluence.links.ConfluenceLinkResolver.makeCreateLink(ConfluenceLinkResolver.java:308)
          at com.atlassian.confluence.links.ConfluenceLinkResolver.makePageLink(ConfluenceLinkResolver.java:251)
          at com.atlassian.confluence.links.ConfluenceLinkResolver.createLink(ConfluenceLinkResolver.java:179)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
          at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
          at java.base/java.lang.Thread.run(Thread.java:840)
      2024-07-09 08:28:09,414 WARN [Long running task: PDF Space Export] [confluence.impl.hibernate.ConfluenceHibernateTransactionManager] doRollback Performing rollback. Transactions:\n  ->[PluginReadWriteTx]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT (Session #919557477)
       -- url: /confluence/spaces/flyingpdf/doflyingpdf.action | userName: admin | action: doflyingpdf | referer: https://linux-75238.prod.atl-cd.net/confluence/spaces/flyingpdf/flyingpdf.action?key=TEST | traceId: 4606c73a6e700c70
       

      The below error is demonstrated in Confluence UI:

      Transaction rolled back because it has been marked as rollback-only
      

      Workaround

      • If Code Block macro is used, then remove "[]" from the Code Block macro header and try to export the space once again.
      • If Wiki Markup macro is used, then remove the hyperlinks or link to a valid page.

      Note
      The page export as PDF for the single page that contains the Code Block macro from the ...> Export to PDF menu works as expected. 

          Form Name

            [CONFSERVER-96128] Space exports as PDF fail If the Code Block macro header contains [] or the Wiki Markup macro includes invalid hyperlinks

            A fix for this issue is available in Confluence Server and Data Center 9.3.1. Upgrade now or check out the Release Notes to see what other issues are resolved.

            Akshay Kumar added a comment - A fix for this issue is available in Confluence Server and Data Center 9.3.1. Upgrade now or check out the Release Notes to see what other issues are resolved.

            An Atlassian support employee informed me in a ticket that, according to his observations, not only the code block macro but also the panel macro is affected.

            Martin Hofmann added a comment - An Atlassian support employee informed me in a ticket that, according to his observations, not only the code block macro but also the panel macro is affected.

              mleizerovich Maxim Leizerovich
              cf2b1c572ccd Ozhan
              Affected customers:
              3 This affects my team
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: