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

Setting the name of an object also changes its parent document reference

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4 M2
    • Fix Version/s: 2.7 RC1, 2.6.1
    • Component/s: None
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      Note that this is a WRONG usecase, objects should not be operated like this but, the following code:

      BaseObject object = document.getObject(objClass, objNumber);
      object.setName(newParentReference);
      

      has as side effect the change of the reference of document, since 2.4M2.

      namely

      document.getReference() 
      

      will be newParentReference on serialization.

      Before, all it was doing was to change the parent document of the object ("move" the object in another document), so, even if the usecase is deprecated, it should not have this side effect since it's breaking compatibility.

        Attachments

          Activity

            People

            • Assignee:
              tmortagne Thomas Mortagne
              Reporter:
              lucaa Anca Luca
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

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