XWiki Platform
  1. XWiki Platform
  2. XWIKI-13826

Failed automatic object data conversion during a property rename results in data loss

    Details

    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      (See the 3 attached xar files)

      Steps to reproduce:

      1. Import class-date.xar
      2. Import data-date.xar
      3. Go to Accounts/TestInstance/?editor=object and see the test property of type date with a date value
      4. Import class-string.xar (thus triggering a conversion of the test property from date to string)
      5. Go to Accounts/TestInstance/?editor=object and see the test property of type string with a successfully converted string value
      6. Import class-data.xar (thus triggering a conversion of the test property from string to date)
      7. Go to Accounts/TestInstance/?editor=object and see the test property of type date with a failed conversion and an empty value, thus losing the data.

      Expected result:
      If the conversion fails, the old data should be preserved as a deprecated property value stored in the object, just like it happens when you manually remove and then add a property with the same name (i.e. manually changing the type of a property).

        Activity

        Hide
        Eduard Moraru added a comment - - edited

        When updating an extension with EM and a property's type is changed, resulting in a failed conversion, an example of the warning message you see in the install log is:

        Incompatible data migration when changing field [instanceCreationDate] of class [Date]
        

        Note: the update itself is marked as successful, even if the warnings are displayed in the logs.

        Show
        Eduard Moraru added a comment - - edited When updating an extension with EM and a property's type is changed, resulting in a failed conversion, an example of the warning message you see in the install log is: Incompatible data migration when changing field [instanceCreationDate] of class [Date] Note: the update itself is marked as successful, even if the warnings are displayed in the logs.
        Hide
        Thomas Mortagne added a comment -

        Note: the update itself is marked as successful, even if the warnings are displayed in the logs.

        The save is successful, that's all EM knows. This warning is produced in an event listener.

        Show
        Thomas Mortagne added a comment - Note: the update itself is marked as successful, even if the warnings are displayed in the logs. The save is successful, that's all EM knows. This warning is produced in an event listener.
        Hide
        Eduard Moraru added a comment -

        Yes. My fix did not change that in any way, just that now the unsuccessfully converted data will not be remove from the object, but kept as a deprecated property. The user is left to decide how to handle it.

        Show
        Eduard Moraru added a comment - Yes. My fix did not change that in any way, just that now the unsuccessfully converted data will not be remove from the object, but kept as a deprecated property. The user is left to decide how to handle it.

          People

          • Assignee:
            Eduard Moraru
            Reporter:
            Eduard Moraru
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

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