Issue Type: Bug Bug
Affects Versions: 4.5.8
Assignee: Unassigned
Attachments: Screen Shot 2013-05-17 at 10.56.30.png
Components: templating
Created: 17/May/13 11:10 AM
Description:

Magnolia allows to nest areas within areas, since AreaDefinition extends TemplateDefinition. Regular rendering of these nested areas works just fine using [@cms.area/] within the template script of the surrounding area.

However, when trying to configure inheritance for such nested areas (see attached screenshot), Magnolia throws an exception during rendering:

...
[INFO] [talledLocalContainer] Caused by: freemarker.template.TemplateException: info.magnolia.rendering.engine.RenderException: Can't render area node /de/unternehmen/footer/footerLinks with name footerLinks
[INFO] [talledLocalContainer] 	at info.magnolia.templating.freemarker.AbstractDirective.execute(AbstractDirective.java:101)
[INFO] [talledLocalContainer] 	at freemarker.core.Environment.visit(Environment.java:274)
[INFO] [talledLocalContainer] 	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
[INFO] [talledLocalContainer] 	at freemarker.core.Environment.visit(Environment.java:221)
[INFO] [talledLocalContainer] 	at freemarker.core.MixedContent.accept(MixedContent.java:92)
[INFO] [talledLocalContainer] 	at freemarker.core.Environment.visit(Environment.java:221)
[INFO] [talledLocalContainer] 	at freemarker.core.Environment.process(Environment.java:199)
[INFO] [talledLocalContainer] 	at freemarker.template.Template.process(Template.java:237)
[INFO] [talledLocalContainer] 	at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:155)
[INFO] [talledLocalContainer] 	at info.magnolia.rendering.renderer.FreemarkerRenderer.onRender(FreemarkerRenderer.java:85)
[INFO] [talledLocalContainer] 	... 127 more
[INFO] [talledLocalContainer] Caused by: info.magnolia.rendering.engine.RenderException: Can't render area node /de/unternehmen/footer/footerLinks with name footerLinks
[INFO] [talledLocalContainer] 	at info.magnolia.templating.elements.AreaElement.end(AreaElement.java:325)
[INFO] [talledLocalContainer] 	at info.magnolia.templating.freemarker.AbstractDirective.execute(AbstractDirective.java:98)
[INFO] [talledLocalContainer] 	... 136 more
[INFO] [talledLocalContainer] Caused by: java.lang.IllegalArgumentException: node /de/footer/footerLinks/0 is already wrapped by info.magnolia.jcr.inheritance.InheritanceContentDecorator$OtherNodeInheritanceNodeWrapper and double wrapping is not supported.
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.setWrappedNode(DelegateNodeWrapper.java:96)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.wrapper.DelegateNodeWrapper.<init>(DelegateNodeWrapper.java:87)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.<init>(ContentDecoratorNodeWrapper.java:71)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.inheritance.InheritanceContentDecorator$OtherNodeInheritanceNodeWrapper.<init>(InheritanceContentDecorator.java:225)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.inheritance.InheritanceContentDecorator.wrapNode(InheritanceContentDecorator.java:101)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.decoration.ContentDecoratorNodeIterator.wrapNode(ContentDecoratorNodeIterator.java:71)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.decoration.ContentDecoratorNodeIterator.nextNode(ContentDecoratorNodeIterator.java:62)
[INFO] [talledLocalContainer] 	at org.apache.jackrabbit.commons.iterator.FilteringNodeIterator.seekNext(FilteringNodeIterator.java:113)
[INFO] [talledLocalContainer] 	at org.apache.jackrabbit.commons.iterator.FilteringNodeIterator.<init>(FilteringNodeIterator.java:42)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.util.NodeUtil.getNodes(NodeUtil.java:604)
[INFO] [talledLocalContainer] 	at info.magnolia.jcr.util.NodeUtil.getNodes(NodeUtil.java:612)
[INFO] [talledLocalContainer] 	at info.magnolia.templating.elements.AreaElement.end(AreaElement.java:258)
[INFO] [talledLocalContainer] 	... 137 more

The issue is that Magnolia tries to double-wrap the inherited nodes.

One can work-around this issue by modifying the freemarker/model code:

[@cms.area name="footerLinks" content=model.unwrap(content.footerLinks)/]

model.unwrap simply does:

    public ContentMap unwrap(ContentMap wrappedContent) throws RepositoryException {
        return new ContentMap(NodeUtil.unwrap(wrappedContent.getJCRNode()));
    }

A cleaner solution/the fix should however, not simply unwrap the node but rather should not wrap the node again. Hence, info.magnolia.jcr.inheritance.InheritanceContentDecorator.wrapNode(Node) should check whether the node is already wrapped.

Project: Magnolia
Labels: inheritance area nested
Priority: Major Major
Reporter: Vivian Steller
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