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

Export to Word throws NullPointerException when Remote Images cannot be loaded

    XMLWordPrintable

Details

    Description

      Steps to Reproduce

      1. Create a page
      2. Insert an image From the Web. You can link it to an image hosted in an anonymously-accessible Confluence instance.
      3. Make sure that the page renders the image properly, then shutdown the server that hosts the image, or simply remove the image
      4. Export the page created earlier to Word

      Notice that the following stack trace will be thrown:

      2013-06-03 23:38:52,775 ERROR [http-8512-5] [ContainerBase.[Standalone].[localhost].[/c512]] log Unhandled exception occurred whilst decorating page
       -- url: /c512/exportword | userName: admin | referer: http://localhost:8512/c512/display/ds/testdasdsa
      java.lang.NullPointerException
      	at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:226)
      	at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:299)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1375)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)
      	at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1354)
      	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2107)
      	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2075)
      	at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1770)
      	at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1749)
      	at com.atlassian.confluence.servlet.ExportWordPageServer.service(ExportWordPageServer.java:188)
      

      Observation

      Editing the page again to try to remove the broken image is not possible, as the image will be "hidden".

      Workaround

      1. Install the Confluence Source Editor
      2. Edit the page, then click on the <> button on the top right corner of the editor
      3. Look for the broken image, example:
        <ac:image>
            <ri:url ri:value="http://localhost:8420/c42/download/attachments/589826/global.logo"/>
          </ac:image>
        
      4. Remove the broken image tags, or change the link to a valid link for the image (if the image have been moved)
      5. Hit Apply, and save the page

      Attachments

        Activity

          People

            Unassigned Unassigned
            fsim Foo Sim (Inactive)
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: