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

PDF macro doesn't load PDF content and returns an NPE on readTrailer15 method

    XMLWordPrintable

Details

    Description

      Issue Summary

      When users insert PDF macro in a page, the macro does not show the content of the PDF. Instead a following error is returned:

      There was a problem converting this attachment

      This issue seems to be a regression of the following closed bug report that was fixed in 6.14: CONFSERVER-20223

      Steps to Reproduce

      1. Head over to a Confluence page.
      2. Add a PDF attachment to the page.
      3. In the Edit mode of the page, head over to the toolbar > Insert > Other Macros > PDF and Insert the macro to the page.

      Expected Results

      The PDF macro will display the PDF in the page.

      Actual Results

      An infinite spinning wheel will be displayed and the following error is returned:

      The following stack trace appears in the logs:

      Caused by: java.lang.NullPointerException
      	at com.sun.pdfview.PDFFile.readTrailer15(PDFFile.java:1167)
      

      Example:

      2020-01-06 11:44:41,971 ERROR [DefaultSlideCacheManager:thread-2] [com.benryan.conversion.AbstractSlideConversionTask] call problem while converting cofc80024577en.pdf
       -- referer: http://localhost:6711/c711/display/TEST/PDF+MACRO+TEST | url: /c711/plugins/servlet/pptslide | traceId: 34f1bbccd1f06e6f | userName: admin
      java.io.IOException: java.lang.NullPointerException
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:56)
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:23)
      	at com.benryan.conversion.AbstractSlideConversionTask.call(AbstractSlideConversionTask.java:40)
      	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.lang.NullPointerException
      	at com.sun.pdfview.PDFFile.readTrailer15(PDFFile.java:1167)
      	at com.sun.pdfview.PDFFile.readTrailer(PDFFile.java:1002)
      	at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1378)
      	at com.sun.pdfview.PDFFile.<init>(PDFFile.java:126)
      	at com.sun.pdfview.PDFFile.<init>(PDFFile.java:102)
      	at com.atlassian.confluence.plugins.conversion.convert.image.PdfConverter.getInputPdfFile(PdfConverter.java:158)
      	at com.atlassian.confluence.plugins.conversion.convert.image.PdfConverter.convert(PdfConverter.java:65)
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:49)
      	... 6 more
      

      or

      2019-12-09 22:14:21,855 ERROR [DefaultSlideCacheManager:thread-2] [com.benryan.conversion.AbstractSlideConversionTask] call problem while converting pdf-test.pdf
       -- referer: http://localhost:8090/display/711/PDF | url: /plugins/servlet/pptslide | traceId: b98cab88e8ea4d24 | userName: admin
      java.io.IOException: java.lang.NullPointerException
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:56)
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:23)
      	at com.benryan.conversion.AbstractSlideConversionTask.call(AbstractSlideConversionTask.java:40)
      	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.lang.NullPointerException
      	at com.sun.pdfview.PDFFile.readTrailer15(PDFFile.java:1290)
      	at com.sun.pdfview.PDFFile.readTrailer(PDFFile.java:1105)
      	at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1378)
      	at com.sun.pdfview.PDFFile.<init>(PDFFile.java:126)
      	at com.sun.pdfview.PDFFile.<init>(PDFFile.java:102)
      	at com.atlassian.confluence.plugins.conversion.convert.image.PdfConverter.getInputPdfFile(PdfConverter.java:158)
      	at com.atlassian.confluence.plugins.conversion.convert.image.PdfConverter.convert(PdfConverter.java:65)
      	at com.benryan.conversion.PdfSlideConversionBatchTask.convertFile(PdfSlideConversionBatchTask.java:49)
      	... 6 more
      
      Note

      Sample attachments that are exhibiting this issue can be found in the Attachment section

      Attachments

        Issue Links

          Activity

            People

              qpham@atlassian.com Quan Pham
              mkhairuliana Monique Khairuliana (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: