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

Exporting a Space or a Page to PDF fails on Confluence Data Center on Windows if the page title has a ':' character

XMLWordPrintable

      Issue Summary

      On Confluence Data Center installed in a Windows server, when sandbox process is enabled to process PDF exports, exporting a page to PDF will fail if the title of the page contains a colon (:) character.
      PDF export of a Space will fail as well if one of the pages has a : in its title.

      Environment

      • Confluence Data Center installed on Windows.
      • Sandbox process enabled to process PDF export.
      • This was validated on Confluence DC 6.13.4 and 6.15.4.

      Steps to Reproduce

      Page Export to PDF

      1. Install a vanilla instance of Confluence Data Center in a Windows server.
      2. Create a page with title "Regular: page".
      3. On the page view mode, click on ... > Export to PDF.
      Expected Results

      PDF export of the page is successfully created and the user receives the browser pop-up to save the PDF file.

      Actual Results

      A system error occurs an error page with a stack trace in the UI.

      Error excerpt with stack trace:

      Cause
      
      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: Failed to create a location and file for the PDF export.
           at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:52) 
      
      caused by: com.atlassian.confluence.importexport.ImportExportException: Failed to create a location and file for the PDF export.
           at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:49) 
      
      caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
           at java.io.WinNTFileSystem.canonicalize0(Native Method) 
      
      Stack Trace:[hide]
      java.lang.RuntimeException: com.atlassian.confluence.importexport.ImportExportException: Failed to create a location and file for the PDF export.
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:52)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportSemaphore.run(PdfExportSemaphore.java:24)
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.execute(ExportPageAsPdfAction.java:25)
      	at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:168)
      	at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
      (...)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: com.atlassian.confluence.importexport.ImportExportException: Failed to create a location and file for the PDF export.
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:49)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:321)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdf(SandboxPdfExporterService.java:307)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForPage(SandboxPdfExporterService.java:206)
      	at com.atlassian.confluence.extra.flyingpdf.DelegatingPdfExporterService.createPdfForPage(DelegatingPdfExporterService.java:61)
      	at com.atlassian.confluence.extra.flyingpdf.DiagnosticPdfExporterService.createPdfForPage(DiagnosticPdfExporterService.java:74)
      	at com.atlassian.confluence.extra.flyingpdf.ExportPageAsPdfAction.doExecute(ExportPageAsPdfAction.java:32)
      	... 383 more
      Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
      	at java.io.WinNTFileSystem.canonicalize0(Native Method)
      	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
      	at java.io.File.getCanonicalPath(File.java:618)
      	at java.io.File.getCanonicalFile(File.java:643)
      	at com.atlassian.confluence.importexport.impl.ConfluenceTempDirExportFileNameGenerator.getExportFile(ConfluenceTempDirExportFileNameGenerator.java:102)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:47)
      	... 389 more
      

      Space Export to PDF

      1. Install a vanilla instance of Confluence Data Center in a Windows server.
      2. Create a sample Space.
      3. Create a page within this Space with title "Regular: page".
      4. On the page view mode click on Space Tools > Content Tools > Export.
      5. Select PDF export and click on Next.
      6. Select Normal Export and click on Export.
      Expected Results

      PDF export of the Space is successfully created and the user can click on a link in the UI to download the PDF file.

      Actual Results

      Space export fails with message Failed to create a location and file for the PDF export.

      An error is logged in atlassian-confluence.log similar to the one below.

      2019-05-15 17:30:45,421 ERROR [Long running task: PDF Space Export] [core.task.longrunning.AbstractLongRunningTask] doInTransactionWithoutResult Error during PDF export
       -- url: /spaces/flyingpdf/doflyingpdf.action | referer: http://localhost:8090/spaces/flyingpdf/flyingpdf.action?key=SPAC | traceId: 3f8ec257427331b4 | userName: admin | action: doflyingpdf
      com.atlassian.confluence.importexport.ImportExportException: Failed to create a location and file for the PDF export.
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:49)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.renderPdf(SandboxPdfExporterService.java:321)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdf(SandboxPdfExporterService.java:307)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfTreeNode(SandboxPdfExporterService.java:245)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfTreeNode(SandboxPdfExporterService.java:251)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxPdfExporterService.createPdfForSpace(SandboxPdfExporterService.java:115)
      	at com.atlassian.confluence.extra.flyingpdf.DelegatingPdfExporterService.createPdfForSpace(DelegatingPdfExporterService.java:56)
      	at com.atlassian.confluence.extra.flyingpdf.DiagnosticPdfExporterService.createPdfForSpace(DiagnosticPdfExporterService.java:54)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask$1.doInTransactionWithoutResult(PdfExportLongRunningTask.java:98)
      	at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.doRunInternal(PdfExportLongRunningTask.java:80)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportSemaphore.run(PdfExportSemaphore.java:24)
      	at com.atlassian.confluence.extra.flyingpdf.PdfExportLongRunningTask.runInternal(PdfExportLongRunningTask.java:67)
      	at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:26)
      	at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:52)
      	at com.atlassian.confluence.impl.util.concurrent.ConfluenceExecutors$ThreadLocalContextTaskWrapper.lambda$wrap$1(ConfluenceExecutors.java:90)
      	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$doInRequestContext$0(VCacheRequestContextOperations.java:50)
      	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContextInternal(VCacheRequestContextManager.java:87)
      	at com.atlassian.confluence.impl.vcache.VCacheRequestContextManager.doInRequestContext(VCacheRequestContextManager.java:71)
      	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.doInRequestContext(VCacheRequestContextOperations.java:49)
      	at com.atlassian.confluence.vcache.VCacheRequestContextOperations.lambda$withRequestContext$2(VCacheRequestContextOperations.java:66)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: java.io.IOException: The filename, directory name, or volume label syntax is incorrect
      	at java.io.WinNTFileSystem.canonicalize0(Native Method)
      	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
      	at java.io.File.getCanonicalPath(File.java:618)
      	at java.io.File.getCanonicalFile(File.java:643)
      	at com.atlassian.confluence.importexport.impl.ConfluenceTempDirExportFileNameGenerator.getExportFile(ConfluenceTempDirExportFileNameGenerator.java:102)
      	at com.atlassian.confluence.extra.flyingpdf.sandbox.SandboxXmlToPdfConverter.convertXhtmlToPdf(SandboxXmlToPdfConverter.java:47)
      	... 26 more
      

      Notes

      This does not affect Confluence Server in Windows nor Confluence Data Center on Linux.
      This is a regression of bug CONFSERVER-24389Export to PDF on Windows returns a stack trace if the name of the page has a ':' symbol.

      Workaround

      There are two options to circumvent this problem:

      1. Advise users to remove the ':' character from pages' title.
      2. Disable PDF exports to be handled by the sandbox process by adding the following JVM argument and restart Confluence:
        -Dpdf.export.sandbox.disable=true
        

        1. page_export_img001.png
          391 kB
          Thiago Masutti
        2. space_export_img001.png
          69 kB
          Thiago Masutti

              Unassigned Unassigned
              tmasutti Thiago Masutti
              Votes:
              6 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated: