diff --git a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/XmlContextHelper.java b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/XmlContextHelper.java index 172355e16..869a1037b 100644 --- a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/XmlContextHelper.java +++ b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/runtime/XmlContextHelper.java @@ -60,7 +60,12 @@ public class XmlContextHelper implements XmlUtility { * Default routine to manage the merging of two values of an XML attribute by suppressing existing value in favor of * a non-empty new one */ - private static final BinaryOperator DEFAULT_ATTRIBUTE_MERGER = (first, second) -> StringUtils.isNotBlank(second) ? second : first; + private static final BinaryOperator DEFAULT_ATTRIBUTE_MERGER = (first, second) -> { + if (StringUtils.isNotBlank(first) && StringUtils.isBlank(second)) { + return first; + } + return StringUtils.isNotEmpty(second) ? second : first; + }; /* --------------------------------- Instance members and constructors diff --git a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/targets/TargetImpl.java b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/targets/TargetImpl.java index ff71e2f1e..c1f19f410 100644 --- a/plugin/src/main/java/com/exadel/aem/toolkit/plugin/targets/TargetImpl.java +++ b/plugin/src/main/java/com/exadel/aem/toolkit/plugin/targets/TargetImpl.java @@ -55,7 +55,12 @@ @SuppressWarnings("HiddenField") // Allows to pass {@code name} arguments in attribute constructors class TargetImpl extends AdaptationBase implements Target, LegacyHandlerAcceptor { - static final BinaryOperator DEFAULT_ATTRIBUTE_MERGER = (first, second) -> StringUtils.isNotBlank(second) ? second : first; + static final BinaryOperator DEFAULT_ATTRIBUTE_MERGER = (first, second) -> { + if (StringUtils.isNotBlank(first) && StringUtils.isBlank(second)) { + return first; + } + return StringUtils.isNotEmpty(second) ? second : first; + }; /* ----------------------------- Local fields and constructors