Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Context-Aware Configuration Impl 1.4.4
-
None
Description
as reported in https://wcm-io.atlassian.net/browse/WCON-39:
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.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; } }