[ 
https://issues.apache.org/jira/browse/SLING-12197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17840834#comment-17840834
 ] 

Stefan Seifert commented on SLING-12197:
----------------------------------------

good point - i discovered that most of the test code for Sling-Initial-Content 
is in this test class:
https://github.com/apache/sling-org-apache-sling-feature-cpconverter/blob/master/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java

and the good thing the unit test uses already a jar file 
{{io.wcm.handler.media-1.11.6.jar}} which is affected exactly by the problem. 
i've found that there is already an implementation that should fix the problem 
described in this ticket (but does not actually), this path is exactly verified 
here as repoinit statement, but fails to be created with sling:Folder currently 
(nt:folder instead):
https://github.com/apache/sling-org-apache-sling-feature-cpconverter/blob/2ed5bdc8ccaf8ab9079268bfbc9d1fdc77bbd485/src/test/java/org/apache/sling/feature/cpconverter/handlers/BundleEntryHandleSlingInitialContentTest.java#L146

so maybe this is a pointer to a strange thing: the whole initial content 
processing with the folder primary types worked initially fine (e.g. with 
cpconverter around 1.1.25), and broke some time later. maybe the root cause is 
not the sling-initial-content processing, but the processing of the repoinit 
statements it creates?

e.g. if the order of deploying the content package generated from the jar file, 
and execution of the repoinit statements is done in the wrong way (package 
first), it will break, if it is done right it will work. because the repoinit 
statements in the unit test look correct and should fix the problem.

maybe the problem is not within cpconverter, but in downstream code picking up 
the resulting packages and repoinit statements, and the problem lies there 
(i.e. AEMaaCS build pipeline)?

> cpconverter: Sling-Initial-Content directories created as nt:folder instead 
> of sling:Folder
> -------------------------------------------------------------------------------------------
>
>                 Key: SLING-12197
>                 URL: https://issues.apache.org/jira/browse/SLING-12197
>             Project: Sling
>          Issue Type: Bug
>          Components: Content-Package to Feature Model Converter
>    Affects Versions: Content-Package to Feature Model Converter 1.3.4
>            Reporter: Stefan Seifert
>            Priority: Major
>             Fix For: Content-Package to Feature Model Converter 1.3.8
>
>         Attachments: io.wcm.handler.link-apps-1.10.2-cp2fm-converted.zip
>
>
> the cpconverter extracts Sling-Initial-Content from OSGi bundles and creates 
> FileVault packages with the transformed content.
> this works well, but there is one difference when the resulting content 
> package is installed compared when uploading the OSGi bundle with the 
> Sling-Initial-Content directly:
> * the JCR Content Loader by defaults creates a {{sling:Folder}} node type for 
> each directory found in the Sling-Initial-Content (see also 
> [docs|https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html#initial-content-loading-1])
> * the cpconverter process creates no {{.content.xml}} file for the folders, 
> but only for the actual JSON files found in the process. as a result, the 
> folders are created as {{nt:folder}} when uploading the transformed package
> * this difference becomes relevant, when a JSON file in Sling-Initial-Content 
> defines a primary type of {{nt:unstructured}} - it is not allowed to created 
> such a node directly below a {{nt:folder}} node - but it is allowed to do so 
> below a {{sling:Folder}} node



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to