You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2017/10/09 08:17:00 UTC

[jira] [Closed] (SLING-7165) CAConfig Impl: Potential data loss when saving multiple nested configuration lists

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

Stefan Seifert closed SLING-7165.
---------------------------------

> CAConfig Impl: Potential data loss when saving multiple nested configuration lists
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-7165
>                 URL: https://issues.apache.org/jira/browse/SLING-7165
>             Project: Sling
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: Context-Aware Configuration Impl 1.4.4
>            Reporter: Stefan Seifert
>            Assignee: Stefan Seifert
>             Fix For: Context-Aware Configuration Impl 1.4.6
>
>
> as reported in https://wcm-io.atlassian.net/browse/WCON-39:
> {quote}
> The following porblem has been discovered by one of our teammates. Consider the following issue.
> * Config A has a list of objects let's call B, where B is an array  of objects, whereeach object in B is a label and list of  objects let's call it C. 
> * Create for each  item in B, a list of items  then save.
> * Try to update the label in any item in B, as a result each sublist  under each object in B, will be deleted as a result. 
> *
> *The problem is i found it in code, you delete all items in the first level, and as a result in the second level. 
> {code}
>  public boolean persistConfigurationCollection(ResourceResolver resourceResolver, String configResourceCollectionParentPath, ConfigurationCollectionPersistData data) {
>         if (!this.config.enabled()) {
>             return false;
>         } else {
>             Resource configResourceParent = this.getOrCreateResource(resourceResolver, configResourceCollectionParentPath, data.getProperties());
> // you delete below all list of items. and subnodes of it
>             this.deleteChildren(configResourceParent);
>             Iterator var5 = data.getItems().iterator();
>             while(var5.hasNext()) {
>                 ConfigurationPersistData item = (ConfigurationPersistData)var5.next();
>                 String path = configResourceParent.getPath() + "/" + item.getCollectionItemName();
>                 this.getOrCreateResource(resourceResolver, path, item.getProperties());
>             }
>             this.commit(resourceResolver, configResourceCollectionParentPath);
>             return true;
>         }
>     }
> {code}
> {quote}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)