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

Cannot rename a page with a link to itself

    XMLWordPrintable

Details

    Description

      This affects Confluence 2.2.x and the current HEAD.

      Renaming a page with a link to itself fails with either a useless warning (in 2.2.x) or a 500 error (in HEAD):

      Invocation of method 'hasChildren' in class com.atlassian.confluence.pages.Page threw exception class net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection: collection was evicted.

      This is caused by an earlier exception, shown only in the logs:

      doSaveEditPageBean: An error occured while storing the requested page!
      com.atlassian.confluence.core.persistence.confluence.StaleObjectStateException: The version of the object to be saved was more than the previous version!

      This is caused by the link refactoring.

      The refactoring process runs before the page title change is done. It updates the link destination, saves the page and increments the version number. The page title is then modified, and the original version number incremented. When this operation attempts to save, the save cannot go ahead with a version number clash and a StaleObjectStateException is thrown.

      I think a possible solution might be to retrieve the current version of the page immediately before saving, rather than storing it in a local variable. This will return the value from the Hibernate cache, and prevent the underlying error.

      I'm not sure why the error is a 500 in HEAD, but handled normally in 2.2. This needs further investigation, as it might affect exception handling in other areas.

      An obvious workaround to this problem is to remove the page's link to itself. Renaming can then proceed normally.

      Attachments

        Activity

          People

            Unassigned Unassigned
            matt@atlassian.com Matt Ryall
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: