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

Actionbar add component fails for an optional area within a page

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Neutral
    • None
    • 5.2.1, 5.2.2
    • pages app
    • None

    Description

      The STK Section page template has an 'Opener' optional area. Selecting the area and then clicking 'Add component' on the action bar fails with the following error in the log:

      2014-03-07 16:12:22,763 ERROR info.magnolia.pages.app.editor.PagesEditorSubApp  : An error occurred while executing action [addComponent]
      javax.jcr.PathNotFoundException: /home/section/bnbmn/opener
          at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:552)
          at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.java:97)
          at org.apache.jackrabbit.core.session.SessionItemOperation$4.perform(SessionItemOperation.java:93)
          at org.apache.jackrabbit.core.session.SessionItemOperation.perform(SessionItemOperation.java:187)
          at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
          at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:361)
          at org.apache.jackrabbit.core.SessionImpl.getItem(SessionImpl.java:786)
          at info.magnolia.jcr.wrapper.DelegateSessionWrapper.getItem(DelegateSessionWrapper.java:154)
          at info.magnolia.jcr.wrapper.DelegateSessionWrapper.getItem(DelegateSessionWrapper.java:154)
          at info.magnolia.jcr.decoration.ContentDecoratorSessionWrapper.getItem(ContentDecoratorSessionWrapper.java:86)
          at info.magnolia.jcr.wrapper.DelegateSessionWrapper.getItem(DelegateSessionWrapper.java:154)
          at info.magnolia.jcr.wrapper.DelegateSessionWrapper.getItem(DelegateSessionWrapper.java:154)
          at info.magnolia.jcr.decoration.ContentDecoratorSessionWrapper.getItem(ContentDecoratorSessionWrapper.java:86)
          at info.magnolia.pages.app.editor.PagesEditorSubApp.prepareAndExecutePagesEditorAction(PagesEditorSubApp.java:390)
          at info.magnolia.pages.app.editor.PagesEditorSubApp.onActionbarItemClicked(PagesEditorSubApp.java:383)
          at info.magnolia.ui.actionbar.ActionbarPresenter.onActionbarItemClicked(ActionbarPresenter.java:183)
          at info.magnolia.ui.vaadin.actionbar.Actionbar$1.onActionTriggered(Actionbar.java:70)
          ...
      

      Steps to reproduce:

      1. Create a page from the STK 'Section' template.
      2. Edit the page and select the 'OPENER [OPTIONAL]' area.
      3. Click the 'Add component' link in the actionbar.

      Looking at the code (PagesEditorSubApp.java:390) it looks like it is expecting the area to exist before then trying to create the new component. Indeed if, instead of the last step, the link on the right of the opener area is clicked then a new opener area is added. This then shows a 'NEW OPENER COMPONENT' underneath the area and then clicking on the 'Add component' link in the actionbar then succeeds.

      I have attached a patch (against master) which fixes the issue, but dubious that this is the best way to do it, since it checks to see if the node doesn't exist and if the user has clicked addComponent on an area and then adds the area. Not sure if it better either to automatically add the optional areas on page create, or alternatively provide the user with a 'Add area' link on the action bar first.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              pphillips Peter Phillips
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD