Error Renaming A Page

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

When renaming a page in Confluence you get the following exception -

1 2 3 4 5 6 7 8 9 10 11 2008-12-22 17:36:20,747 ERROR [http-80-Processor7] [com.opensymphony.xwork.ActionSupport] doSaveEditPageBean An error occured while storing the requested page! -- url: /pages/doeditpage.action | userName: adminxiei | action: doeditpage | page: 61178183 | referrer: http://localhost/pages/editpage.action?pageId=61178183 java.lang.NullPointerException at com.atlassian.confluence.util.AttachmentLinkRenamingBean.getReplacingLinkPageTitle(AttachmentLinkRenamingBean.java:120) at com.atlassian.confluence.util.AttachmentLinkRenamingBean.<init>(AttachmentLinkRenamingBean.java:62) at com.atlassian.confluence.links.DefaultLinkManager.getContentWithRenamedLinks(DefaultLinkManager.java:151) ......... at $Proxy9.getContentWithRenamedLinks(Unknown Source) at com.atlassian.confluence.core.DefaultContentEntityManager.updateSingleContentLinkinTo(DefaultContentEntityManager.java:212) at com.atlassian.confluence.core.DefaultContentEntityManager.updateContentLinkingTo(DefaultContentEntityManager.java:197)

While Renaming a page Confluence will update links on a given page to reflect a change to an attachment links, the AttachmentLinkRenamingBean is responsible for updating the Page name -

1 2 3 4 5 6 7 8 9 10 11 12 13 private String getReplacingLinkPageTitle(ContentEntityObject referringContent, String spaceKey, String pageTitle) { if (referringContent instanceof SpaceContentEntityObject) { if (!((SpaceContentEntityObject) referringContent).getSpaceKey().equals(spaceKey)) { return spaceKey + ":" + pageTitle; } } return StringUtils.equals(referringContent.getTitle(), pageTitle) ? "" : pageTitle; }

The line throwing the NPE is:

1 2 if (!((SpaceContentEntityObject) referringContent).getSpaceKey().equals(spaceKey))

The getSpaceKey() method is returning null - because there is a link (on a page with nospace) to an attachment on the page being renamed.

Cause

The root cause us that in a previous version the page or attachment was in a Space which no longer exists. The page was moved from another space, and when the original space was deleted, Confluence updated references to the space with null values.

Resolution

Since its is not possible to delete the page version history of a page at this siage - the only option here is to find the attachment causing the exception by enabling SQL logging, delete the attachment on that page and reattach it after performing the rename.

If deleting the attachment does not work, you can try to find the offending link from the database:

1 2 3 select * from links where destpagetitle='faulty page title' and destspacekey = 'the space key of the faulty page'; delete from links where linkid=<linkid>;

ℹ️ <linkid> is the linkid returned from the select query.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.