[MAGNOLIA-5633] Wrong behaviour during creating version when maxVersionIndex is set to negative number Created: 22/Jan/14  Updated: 23/Jan/14  Resolved: 23/Jan/14

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.2

Type: Bug Priority: Major
Reporter: Milan Divilek Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to MAGNOLIA-5616 Restore of a deleted page is not poss... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

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.


Generated at Mon Feb 12 04:06:57 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.