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

PDF Exporter doesn't handle situations when JTidy fails

    XMLWordPrintable

Details

    Description

      I found many occurences of this error in our logs:

      ERROR 2008-07-30 14:43:01,638 [service-j2ee-12] WikiExporter:exportWikiToXslFo - Error while generating XSL-FO for 'Restricted:pdf export test'
       -- url: /wikis/pages/doexportpage.action | userName: igorminar | action: doexportpage | page: 11468802
      com.atlassian.confluence.renderer.WikiRenderException: Can not transform XHTML to XSL-FO due to an error in the following XHTML null
              at com.atlassian.confluence.importexport.impl.WikiExporter.convertXHtmlToXslFo(WikiExporter.java:213)
              at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXslFo(WikiExporter.java:143)
              at com.atlassian.confluence.importexport.impl.WikiExporter.exportWikiToXslFo(WikiExporter.java:102)
      ...
      ...
      Caused by: java.lang.NullPointerException
              at org.dom4j.io.DOMReader.read(DOMReader.java:86)
              at com.atlassian.confluence.importexport.impl.WikiExporter.initializeXHtml(WikiExporter.java:230)
              at com.atlassian.confluence.importexport.impl.WikiExporter.convertXHtmlToXslFo(WikiExporter.java:178)
              ... 143 more
      

      I was able to narrow it down to:

      h1.{panel:title=Foo}{panel}
      

      Which generates:

      <h1>
      <a name="pdfexporttest-"/>
      <div class="panel" style="border-width: 1px;">
      <div class="panelHeader" style="border-bottom-width: 1px;">
      </div>
      </div>
      </h1>
      

      This invalid html is then being processed through JTidy, but even JTidy is not able make sense of it and returns null, which is not expected by Confluence and therefore Confluence throws an error.

      IMO this is a user and JTidy error, but I think that Confluence should be able to handle the situation more gracefully. Showing a stacktrace when user is trying to export a page or an entire space is not going to tell him that the input is incorrect.

      Attachments

        Activity

          People

            Unassigned Unassigned
            15d9a6950818 Igor Minar
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: