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

XWikiDocument toXML lists attachments in an inconsistent order

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7, 3.0 M1, 3.0 M2
    • Fix Version/s: 10.1-rc-1
    • Component/s: Old Core
    • Tests:
      Unit
    • Difficulty:
      Easy
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:
    • GCI categories:
      Code

      Description

      If it's your first Google Code-In task it's highly recommended to start with Become a community member.

      Prerequisites

      • Assign yourself to the Jira issue

      Issue

      Since toXML lists attachment in the order in the internal List, and that the internal list reads them in the order the database gives them, which gives them (database specific) in the order of creation in the DB, the XML output of XWiki can be inconsistent accross wikis especially when importing XMLs.

      This leads to differences when comparing the XML although they are the same (problem verified with the SVN commit app).

      We need to make sure that the attachments are always listed in the same order (ideally the creation date).

      Since getting the creation order is complex we should probably just use ASCII order (any order is good as long as it's stable).

      The best is probably the refactor XWikiDocument#attachmentList into a TreeMap (as a bonus it will improve the speed of methods like XWikiDocument#getAttachment()).

      Expected Outcome

      • The student must commit the changes and create a pull request on https://github.com/xwiki/xwiki-platform
        • The summary of the Pull Request must have a first line matching the JIRA issue following by a colon and then the title of this issue
        • Add a comment in the jira issue mentioning your pull request and provide a link to it

      Links

      Getting help

      If you have any question you should use the Chat (faster answer, but when there is someone around) or the Forum (more people available, but slower answer).

        Attachments

          Activity

            People

            • Assignee:
              akshitdewan Akshit Dewan
              Reporter:
              ludovic Ludovic Dubost
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

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