You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (Jira)" <ji...@apache.org> on 2021/06/28 07:44:00 UTC

[jira] [Assigned] (KARAF-7187) cfg file layout is destoyed when reinstalling existing feature

     [ https://issues.apache.org/jira/browse/KARAF-7187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean-Baptiste Onofré reassigned KARAF-7187:
-------------------------------------------

    Assignee: Jean-Baptiste Onofré

> cfg file layout is destoyed when reinstalling existing feature
> --------------------------------------------------------------
>
>                 Key: KARAF-7187
>                 URL: https://issues.apache.org/jira/browse/KARAF-7187
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf
>    Affects Versions: 4.3.2
>            Reporter: Rastislav Papp
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>
> Let's say we have a cfg file, which is part of a feature (via {{<config external="true" override="true">}}). 
>  When we install the feature installed for the first time, this file is created under /etc directory. When I uninstall the feature, the file is kept, and when I install it again, the file gets broken - it's layout is destroyed and all property placeholders inside are replaced with actual values - which could be a problem (i.e. when updating the value of the placeholder).
> To illustrate, let's say we have this cfg file:
> {code:java}
> property1=value1
> property2=\
>    xxx${property1}yyy\
>    continuing the value on another line
> {code}
> After uninstalling and reinstalling a feature which overwrites this file, the result is:
> {code:java}
> property1=value1
> property2=xxxvalue1yyycontinuing the value on another line
> {code}
> which is not at all good:
>  * when updating value of property1, we expect that property2 will change accordingly (but it no longer does)
>  * multiline formatting is lost
> The culprint is {{org.apache.karaf.features.internal.service.FeatureConfigInstaller#updateExistingConfig}}, line:
> {code:java}
> properties.put(key, comments, value);
> {code}
> which eventually calls {{org.apache.felix.utils.properties.Properties#put(java.lang.String, java.util.List<java.lang.String>, java.lang.String)}}, causing the original {{Layout}} to be lost:
> {code:java}
> this.layout.put(key, new Layout(commentLines, null));
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)