From 414d730962f6a2ab0d5f31ef39a3e16b0d553cb3 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 7 Jun 2018 17:15:16 +0200 Subject: [PATCH] Optimize XmlStringBuilder.element() for the empty element case For example RSM (XEP-0059) gives a different semantic as UID. --- .../java/org/jivesoftware/smack/util/XmlStringBuilder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 0fdaceeb8..3f60077f4 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -75,7 +75,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { * @return the XmlStringBuilder */ public XmlStringBuilder element(String name, String content) { - assert content != null; + if (content.isEmpty()) { + return emptyElement(name); + } openElement(name); escape(content); closeElement(name);