Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6815

Error when deleting attachment from XWikiPreferences when XWikiPreferences not in the document cache

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.2 M2
    • 3.2 M1
    • Storage
    • None
    • Unknown

    Description

      The error is

      Wrapped Exception: a different object with the same identifier value was already associated with the session: [com.xpn.xwiki.doc.XWikiDocument#104408758]
              at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java:849) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.store.XWikiCacheStore.loadXWikiDoc(XWikiCacheStore.java:296) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1472) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.XWiki.getDocument(XWiki.java:1515) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.XWiki.getXWikiPreference(XWiki.java:2252) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.XWiki.hasBacklinks(XWiki.java:6210) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.store.XWikiHibernateStore.saveXWikiDoc(XWikiHibernateStore.java:678) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.store.XWikiCacheStore.saveXWikiDoc(XWikiCacheStore.java:183) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.deleteXWikiAttachment(XWikiHibernateAttachmentStore.java:279) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.store.XWikiHibernateAttachmentStore.deleteXWikiAttachment(XWikiHibernateAttachmentStore.java:215) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:4500) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:4480) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
              at com.xpn.xwiki.web.DeleteAttachmentAction.action(DeleteAttachmentAction.java:127) [xwiki-platform-oldcore-3.2-20110802.181227-125.jar:na]
      

      What happens is that deleteXWikiAttachment() saves the document and while doing so it checks if there are backlinks. This check is done by looking at XWikiPreferences. Thus if it's not in the document cache Hibernate will try to load it and fail since it's in a session that already has it in memory.

      The use case for this is when trying to delete an attachment from the Admin Import screen.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: