-
Bug
-
Resolution: Not an issue
-
Critical
-
None
-
5.4.5, 5.4.6
-
-
Empty show more show less
-
Basel 46
-
2
When using a info.magnolia.ui.form.field.definition.LinkFieldDefinition and a MultivalueChildNodetransformer, it works if the item is already created, but fails if you create a new item. This was tested on the security app creating a new user.
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:400) at java.util.ArrayList.remove(ArrayList.java:477) at info.magnolia.ui.vaadin.integration.jcr.AbstractJcrNodeAdapter.sortChildren(AbstractJcrNodeAdapter.java:249) at info.magnolia.ui.vaadin.integration.jcr.AbstractJcrNodeAdapter.updateChildren(AbstractJcrNodeAdapter.java:215) at info.magnolia.security.app.dialog.action.SaveUserDialogAction.createOrUpdateUser(SaveUserDialogAction.java:183) at info.magnolia.security.app.dialog.action.SaveUserDialogAction.execute(SaveUserDialogAction.java:97) at info.magnolia.ui.api.action.AbstractActionExecutor.execute(AbstractActionExecutor.java:62) ... 123 more
OUTCOME
---------------
The transformer seems to work fine. The ArrayIndexOutOfBoundsException is caused by a wrong if condition at AbstractJcrNodeAdapter.sortChildren(Node, List<String>) line #244. However, when getting rid of that, another issue arises with a user creation. The sub-node companies cannot be created under a not yet existing user node and so it ends up under e.g. the /admin node. I got it working by fixing the cause for the AIOOBE at MGNLUI-3892 plus this patch https://git.magnolia-cms.com/users/fgrilli/repos/ui/commits/a5548e44bbc8de4ec05693cf1217848e73c9e543#security-app/src/main/java/info/magnolia/security/app/dialog/action/SaveUserDialogAction.java
However, the dev team is not keen on including the fix to SaveUserDialogAction.java in the code base as having a user sub-node with custom properties seems more like a customer-specific need for a given project and not something we want to support out of the box. So we would suggest the customer to create/extend a custom SaveUserDialogAction and apply the above patch. Case is different for the inability of User to support multivalued properties (again not a transformer problem MAGNOLIA-6679). That needs to be fixed but since it requires an API breaking change it can be done only in a major release. The current issue would be closed with Workaround exists or Not an issue
- is related to
-
MGNLUI-3892 Updating sortable node children may throw ArrayIndexOutOfBoundsException
- Closed