diff --git a/WHATSNEW b/WHATSNEW
index 3308d1b82..ae34ab1af 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -24,6 +24,9 @@ Fixed bugs:
* created junitvmwatcher*.properties files but did not close and delete them.
+* did not create properties for empty leaf elements.
+ Bugzilla report 26286.
+
Other changes:
--------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
index 5af01f4f5..7ec448d26 100644
--- a/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
+++ b/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
@@ -430,6 +430,9 @@ public class XmlProperty extends org.apache.tools.ant.Task {
&& (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)) {
nodeText = node.getFirstChild().getNodeValue();
+ } else if ((node.getNodeType() == Node.ELEMENT_NODE)
+ && (node.getChildNodes().getLength() == 0)) {
+ nodeText = "";
}
if (nodeText != null) {
@@ -439,9 +442,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
id = (String) container;
}
- if (nodeText.trim().length() != 0) {
- addProperty(prefix, nodeText, id);
- }
+ addProperty(prefix, nodeText, id);
}
// Return the Path we added or the ID of this node for