Issue Type: Bug Bug
Affects Versions: 5.2.2, 5.2.1
Assignee: Unassigned
Attachments: AddOptionalComponent.patch
Components: pages app
Created: 10/Mar/14 2:35 PM
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.

Project: Magnolia UI
Priority: Neutral Neutral
Reporter: Peter Phillips
Security Level: Public
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to