NullPointerException at javax.mail.internet.MimeUtility.getEncoding When Exporting Page to Word

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Exporting a page to Word results in this browser error:

The following appears in the atlassian-confluence.log:

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)

Cause

There are broken remote images in the page (images linked from the web that can no longer be loaded - image may have been moved, removed, or the server hosting the image may be down). Editing the page again to try to remove the broken image is not possible, as the image will be "hidden".

Resolution

  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
Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.