This error occurs when exporting to PDF. The page contains the Code macro that has spaces between text and quote marks.

      The following steps use to reproduce the problem:

      1. Create a page (named Page A)
      2. Paste the following Code macro in Page A:
        {code}
        "     Integer"
        {code}
        
      3. Try to export page A via Info > PDF.

      You should be able to see the similar error exception in the stack trace:

       Cause:
      com.atlassian.confluence.importexport.ImportExportException: Error while generating PDF!
       at com.atlassian.confluence.importexport.impl.PdfExporter.foToPdf(PdfExporter.java:137)
      caused by: javax.xml.transform.TransformerException: java.lang.ArrayIndexOutOfBoundsException: -1
       at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:61)
      caused by: java.lang.ArrayIndexOutOfBoundsException: -1
       at java.util.ArrayList.get(ArrayList.java:323)
      

            [CONFSERVER-11184] Code macro breaks PDF export

            Confluence 3.0 includes a new PDF Export mechanism which does not have this problem.

            Paul Curren added a comment - Confluence 3.0 includes a new PDF Export mechanism which does not have this problem.

            Paul King added a comment - - edited

            I would like to see this issue solved too as per CSP-18090. Thanks, Paul.
            (I couldn't seem to link through to the CSP Jira.)

            Paul King added a comment - - edited I would like to see this issue solved too as per CSP-18090. Thanks, Paul. (I couldn't seem to link through to the CSP Jira.)

            Don Willis added a comment -

            The important bits of the snippet seem to be the pattern: a quote, followed by more than one space, followed by a keyword (as recognised by the code macro), followed by a quote. This produces a fop snippet like this:

            <fo:inline role="html:span">"  <fo:inline role="html:span">int</fo:inline>"</fo:inline>
            

            With only one quote we get xml that doesn't fail:

            "  <fo:inline role="html:span">int</fo:inline>
            

            With only one space we get xml that doesn't fail:

            <fo:inline role="html:span">" <fo:inline role="html:span">int</fo:inline> "</fo:inline>
            

            Not being an expert on fo, I'm not exactly sure why the different snippets do or don't fail.
            None of the samples actually render well in the pdfs. That is, the highlighting expected for stings and variables isn't present in the PDF.

            Don Willis added a comment - The important bits of the snippet seem to be the pattern: a quote, followed by more than one space, followed by a keyword (as recognised by the code macro), followed by a quote. This produces a fop snippet like this: <fo:inline role= "html:span" > " <fo:inline role=" html:span "> int </fo:inline> " </fo:inline> With only one quote we get xml that doesn't fail: " <fo:inline role=" html:span"> int </fo:inline> With only one space we get xml that doesn't fail: <fo:inline role= "html:span" > " <fo:inline role=" html:span "> int </fo:inline> " </fo:inline> Not being an expert on fo, I'm not exactly sure why the different snippets do or don't fail. None of the samples actually render well in the pdfs. That is, the highlighting expected for stings and variables isn't present in the PDF.

              Unassigned Unassigned
              cltham Choy Li Tham [Atlassian]
              Affected customers:
              2 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: