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

XWikiDocument#setXObject does not work if there is not already an object of the provided class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.3, 3.4-milestone-1
    • 3.2
    • Old Core
    • None
    • Unknown

    Description

      This method internally use getXObjects(classReference) to get the actually list to add the provided object to except that the list returned by getXObjects(classReference) is just a new ArrayList<BaseObject>() stored nowhere when there is no object of this class...

      Same things for:

      • setXObject(DocumentReference classReference, int nb, BaseObject object)
      • createXObject
      • addXObject
      • setXObject(int nb, BaseObject object)

      I think getXObjects(DocumentReference) changed at some point and broke them since they are all broken because of a missunderstanding on how it's supposed to work: they all expect it to return null when there is no object of this class but it returns a new ArrayList (which makes a lots more sens than null since it should never return null, Collections#EMPTY_LIST would be event better but I have the crappy code is using getXObject(reference).add()...).

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            tmortagne Thomas Mortagne
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: