Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-3860

MultiValueChilNodeTransformer does not work with a linkfield

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an issue
    • Icon: Critical Critical
    • None
    • 5.4.5, 5.4.6
    • dialogs
    • 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

        Acceptance criteria

              fgrilli Federico Grilli
              tmiyar Teresa Miyar
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 1d
                    1d