diff --git a/prj/coherence-core/src/main/java/com/tangosol/coherence/config/xml/processor/CacheConfigOverrideProcessor.java b/prj/coherence-core/src/main/java/com/tangosol/coherence/config/xml/processor/CacheConfigOverrideProcessor.java index 933acdf6f140..3656829edf3b 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/coherence/config/xml/processor/CacheConfigOverrideProcessor.java +++ b/prj/coherence-core/src/main/java/com/tangosol/coherence/config/xml/processor/CacheConfigOverrideProcessor.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.List; +import com.oracle.coherence.common.base.Logger; import com.tangosol.config.xml.OverrideProcessor; import com.tangosol.run.xml.XmlElement; import com.tangosol.run.xml.XmlHelper; @@ -75,9 +76,9 @@ else if ("interceptors".equals(xmlElement.getName())) private void processSchemeMappings(XmlElement xmlBase, XmlElement xmlOverrideSchemeMappings, String sMappingSubElementName) { - List listElements = new ArrayList<>(); - XmlElement xmlCurrentElement = xmlBase.getElement(xmlOverrideSchemeMappings.getName()); + List listElements = new ArrayList<>(); + XmlElement xmlCurrentElement = xmlBase.getElement(xmlOverrideSchemeMappings.getName()); if (xmlCurrentElement == null) { listElements.add(xmlOverrideSchemeMappings); @@ -199,8 +200,7 @@ else if (!listElements.contains(xmlElementOverride)) */ private void processCachingSchemes(XmlElement xmlBase, XmlElement xmlOverrideCachingSchemes) { - List listElements = new ArrayList(); - XmlElement xmlCurrentElement = xmlBase.getElement(xmlOverrideCachingSchemes.getName()); + List listElements = new ArrayList(); for (Object subElements : xmlOverrideCachingSchemes.getElementList()) { @@ -229,20 +229,30 @@ private void processCachingSchemes(XmlElement xmlBase, XmlElement xmlOverrideCac if (sSchemeName.equals(sOverrideSchemeName)) { - if (!xmlElementName.equals(sSubElementName)) + XmlElement xmlElementRemove = null; + + for (XmlElement xmlEl : listElements) { - xmlElementBase.setName(sSubElementName); + XmlElement xmlElSchemeName = xmlEl.getElement("scheme-name"); + if (xmlElSchemeName != null + && sOverrideSchemeName.equals(xmlElSchemeName.getValue().toString())) + { + xmlElementRemove = xmlEl; + break; + } } - xmlElementBase.getElementList().clear(); - xmlElementBase.getElementList().addAll(xmlOverride.getElementList()); + if (xmlElementRemove != null) + { + listElements.remove(xmlElementRemove); + } - if (listElements.contains(xmlOverride)) + if (!xmlElementName.equals(sSubElementName)) { - listElements.remove(xmlOverride); + xmlElementBase.setName(sSubElementName); } - break; + XmlHelper.overrideElement(xmlElementBase, xmlOverride); } else if (!listElements.contains(xmlOverride)) { @@ -267,7 +277,7 @@ else if (!listElements.contains(xmlOverride)) if (!listElements.isEmpty()) { - XmlHelper.addElements(xmlCurrentElement, listElements.iterator()); + XmlHelper.addElements(xmlBase.getElement(xmlOverrideCachingSchemes.getName()), listElements.iterator()); listElements.clear(); } }