-
Bug
-
Resolution: Cannot Reproduce
-
Neutral
-
None
-
6.0
-
None
MultivalueField doesn't keep order of its elements when, according to test results, more than 128 elements.
Steps to reproduce:
- Insert in multivalue field 128 elements
- Change order of the two first elements: it works
- Change order of the two last elements: it doesn't keep the order
The cause of the error resides in info.magnolia.ui.form.field.MultiField class when calling switchItemProperties(Object, Object) method after changing the multivalue order. The comparison between identifiers is made with == operator which works fine with the first 127 elements but after that, objects compared are not the same (although they have same values) and therefore, condition is not true and the order is not changed:
info.magnolia.ui.form.field.MultiField.switchItemProperties(Object, Object)
... if (propertyId == firstPropertyId) { getValue().addItemProperty(firstPropertyId, propertySecond); } else if (propertyId == secondPropertyId) { getValue().addItemProperty(secondPropertyId, propertyFirst); } else { getValue().addItemProperty(propertyId, storedValues.getItemProperty(propertyId)); } ...
Switching comparison operator to equals() should fix this issue.
Acceptance criteria