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

When you import a page, that have no attachment and overwrite an existing page containing attachments, some errors appear with them.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5, 3.5.1
    • Fix Version/s: 5.2-rc-1
    • Component/s: Old Core
    • Labels:
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      When you import a page, that have no attachment and overwrite an existing page containing attachments, some errors appear with attachments.

      Steps:

      1 - Create a new page. Export it as a XAR.
      2 - Attach a file to the page, let say A.jpg
      3 - Import the XAR you have created during 1)

      Now come back to your page and look: the attachments list is empty.

      If you go to Main.AllDocs, you will not see A.jpg on DeletedAttachment, but you will see it on regular Attachments. If you try to see it by clicking on it, you will have an error (file doesn't exist).

      Then:
      4 - Attach a new file to your page, let say B.jpg

      Now, you will see B.jpg AND a.jpg in the attachment list of the page. This is the first problem: this behaviour is weird for the user.

      NOTE: if you don't attach a new file, and try to rollback to the version that have the first attachment, everything will work. It is important for the following.

      NOW, enable filesystem storage for attachments:
      xwiki.store.main.hint=hibernate
      xwiki.store.attachment.hint=file
      xwiki.store.versioning.hint=hibernate
      xwiki.store.attachment.versioning.hint=file
      xwiki.store.recyclebin.hint=hibernate
      xwiki.store.attachment.recyclebin.hint=file
      xwiki.store.migration.manager.hint=hibernate

      5 - Create a new page. Export it as a XAR.
      6 - Attach a file to that page, let say C.jpg
      7 - Import the XAR you have created during 5)

      PROBLEM: try now to rollback to the version of that page with the attachment. You can't, you have the following error:
      [...]
      Wrapped Exception:

      java.lang.NullPointerException
      at org.xwiki.store.legacy.store.internal.FilesystemAttachmentRecycleBinStore.getAllDeletedAttachments(FilesystemAttachmentRecycleBinStore.java:293)
      at com.xpn.xwiki.XWiki.rollback(XWiki.java:6996)
      [...]

      8 - attach a new file to the page, let say D.jpg
      9 - you will have all the attachments in the page.

      So, in this case, the problem block the user who want to do a rollback.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gdelhumeau Guillaume Delhumeau
                Reporter:
                gdelhumeau Guillaume Delhumeau
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: