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

Bertrand Delacretaz commented on SLING-7920:
--------------------------------------------

Fixed with this commit, by accumulating multiple repoinit sections and 
outputting a single repoinit extension json:

[https://github.com/apache/sling-org-apache-sling-feature-modelconverter/commit/fb225c9b480ea330c1212833a237e5b4cf00258a]

[~bosschaert] I think you wrote the original code, could you review my changes 
and tests?

I'm throwing the {{IllegalStateException("Repoinit sections already 
processed")}} exception if the repoinit extension was already present in the 
feature model, as I don't have a use case to test that branch. It wasn't tested 
before my changes either, and caused the {{IllegalStateException}}. In this way 
that untested use case will fail loudly if we encounter it.

> IllegalStateException in Model-to-Feature converter for multiple repoinit 
> sections
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-7920
>                 URL: https://issues.apache.org/jira/browse/SLING-7920
>             Project: Sling
>          Issue Type: Bug
>          Components: Feature Model
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>            Priority: Minor
>             Fix For: Feature Model Converter 0.1.4
>
>
> Trying to convert the sling-org-apache-sling-starter I get the below 
> exception, as due to SLING-7919 the sling-event feature there contains two 
> :repoinit sections.
> {code}
> Exception in thread "main" java.lang.IllegalStateException
>       at org.apache.sling.feature.Extension.getText(Extension.java:111)
>       at 
> org.apache.sling.feature.modelconverter.ProvisioningToFeature.buildFromFeature(ProvisioningToFeature.java:444)
>       at 
> org.apache.sling.feature.modelconverter.ProvisioningToFeature.buildFeatures(ProvisioningToFeature.java:477)
>       at 
> org.apache.sling.feature.modelconverter.ProvisioningToFeature.convert(ProvisioningToFeature.java:113)
>       at org.apache.sling.feature.modelconverter.impl.Main.main(Main.java:195)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to