Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5633

Wrong behaviour during creating version when maxVersionIndex is set to negative number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 5.2.2
    • None
    • None
    • None

      When creating version info.magnolia.cms.core.version.BaseVersionManager#createVersion checks if maxVersionIndex is set to negative number. If yes then it doesn't create new version, but instead of it createVersion method just return root version.

       node.getVersionHistory().getRootVersion(); 

      It doesn't get version history from node in version workspace. So it will fail on UnsupportedRepositoryOperationException. If we change code to something like

      VersionHistory versionHistory = getVersionHistory(node);
      return versionHistory != null ? versionHistory.getRootVersion() : null;
      

      then it will get version history from node in version workspace, but if we use versioning before activation then ActivationCommand will try to activate "jcr:rootVersion" version. Instead of activating jcr:rootVersion version(which fails) it should activate current state of node.
      So if can't create version then we shouldn't return "jcr:rootVersion" from method createVersion but instead of it we should simply return null and handle with this state.

        Acceptance criteria

              mdivilek Milan Divilek
              mdivilek Milan Divilek
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD