diff --git a/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java b/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java
index 8efa7de5..555f481e 100644
--- a/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java
+++ b/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java
@@ -95,8 +95,6 @@ public void writeToSerializer( String namespace, XmlSerializer serializer, Xpp3D
*
*
If mergeSelf == true
*
- * - if the dominant root node's value is empty, set it to the recessive root node's value
- * - For each attribute in the recessive root node which is not set in the dominant root node, set it.
* - Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as
* siblings (flag=mergeChildren).
*
@@ -140,12 +138,6 @@ private static void mergeIntoXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive, Boole
if ( mergeSelf )
{
- if ( isEmpty( dominant.getValue() ) && !isEmpty( recessive.getValue() ) )
- {
- dominant.setValue( recessive.getValue() );
- dominant.setInputLocation( recessive.getInputLocation() );
- }
-
String[] recessiveAttrs = recessive.getAttributeNames();
for ( String attr : recessiveAttrs )
{
diff --git a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java
index 9d1e21e6..9e244f19 100644
--- a/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java
+++ b/src/test/java/org/codehaus/plexus/util/xml/Xpp3DomUtilsTest.java
@@ -115,7 +115,7 @@ public void testCombineKeys()
}
@Test
- public void testOverwriteDominantBlankValue() throws XmlPullParserException, IOException {
+ public void testPreserveDominantBlankValue() throws XmlPullParserException, IOException {
String lhs = " ";
String rhs = "recessive";
@@ -127,6 +127,20 @@ public void testOverwriteDominantBlankValue() throws XmlPullParserException, IOE
assertEquals( " ", mergeResult.getValue() );
}
+ @Test
+ public void testPreserveDominantEmptyNode() throws XmlPullParserException, IOException
+ {
+ String lhs = "";
+
+ String rhs = "recessive";
+
+ Xpp3Dom leftDom = Xpp3DomBuilder.build( new StringReader( lhs ), new FixedInputLocationBuilder( "left" ) );
+ Xpp3Dom rightDom = Xpp3DomBuilder.build( new StringReader( rhs ), new FixedInputLocationBuilder( "right" ) );
+
+ Xpp3Dom mergeResult = Xpp3DomUtils.mergeXpp3Dom( leftDom, rightDom, true );
+ assertEquals( "", mergeResult.getValue() );
+ }
+
@Test
public void testIsNotEmptyNegatesIsEmpty()
{