[
https://issues.apache.org/jira/browse/SLING-6462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16326935#comment-16326935
]
Konrad Windszus commented on SLING-6462:
----------------------------------------
I modified the behaviour slightly in
https://issues.apache.org/jira/browse/SLING-6453 so maybe this has fixed this
issue as well.
> Filter Isolated jcr:content nodes (by includes) are not deployed
> ----------------------------------------------------------------
>
> Key: SLING-6462
> URL: https://issues.apache.org/jira/browse/SLING-6462
> Project: Sling
> Issue Type: Bug
> Components: Tooling
> Environment: MacOS Sierra, JDK 1.8, latest Sling
> Reporter: Andreas Schaefer
> Priority: Major
> Fix For: Sling Eclipse IDE 1.2.0
>
> Attachments: SLING-6462.zip
>
>
> If a jcr:content node is included by a filter.xml but not its parent then the
> deployment of the corresponding .content.xml fails and with it its parent
> node becomes a Sling Folder and the jcr:content node is missing.
> Assuming we have the following on our file system:
> - A folder /etc/designs/base
> - A file .content.xml in that folder:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
> xmlns:cq="http://www.day.com/jcr/cq/1.0"
> xmlns:jcr="http://www.jcp.org/jcr/1.0"
> jcr:primaryType="cq:Page">
> <jcr:content
> cq:doctype="html_5"
> cq:template="/libs/wcm/core/templates/designpage"
> jcr:primaryType="cq:PageContent"
> jcr:title="AEM Base Components"
> sling:resourceType="wcm/core/components/designer"/>
> </jcr:root>
> {code}
> A filter.xml:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <workspaceFilter version="1.0">
> <filter root="/apps/base"/>
> <filter root="/etc/clientlibs/base"/>
> <filter root="/etc/designs/base">
> <include pattern="/etc/designs/base/jcr:content"/>
> </filter>
> <!--
> <filter root="/etc/designs/base"/>
> -->
> </workspaceFilter>
> {code}
> Taking out the include filter and replace it with the comment out one below
> makes the deployment work.
> Some preliminary investigations revealed that the
> ResourceChangeCommandFactory.getFilterResult() returns
> PREREQUISITE instead of ALLOW as the path that is tested is /etc/designs/base
> instead of /etc/designs/base/jcr:content.
> Locally I added that code after the filter.filter() call and before the
> return:
> {code:java}
> //AS NOTE: If we have a jcr:content and it is limited by an include then it
> might fail
> //AS NOTE: (DENY) or worse coming back as PREREQUISITE making an undefined
> node. Here it
> //AS NOTE: checks if the resource proxy has a child of jcr:content and if so
> check with
> //AS NOTE: that path.
> if(filterResult != FilterResult.ALLOW && resourceProxy != null) {
> List<ResourceProxy> resourceProxyChildren = resourceProxy.getChildren();
> if(resourceProxyChildren.size() == 1) {
> ResourceProxy child = resourceProxyChildren.get(0);
> if(child.getPath().endsWith("/jcr:content")) {
> FilterResult temp = filter.filter(child.getPath());
> if(temp == FilterResult.ALLOW) {
> return FilterResult.ALLOW;
> }
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)