1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

Optimize XmlStringBuilder.element() for the empty element case

For example RSM (XEP-0059) gives <before/> a different semantic as
<before>UID</before>.
This commit is contained in:
Florian Schmaus 2018-06-07 17:15:16 +02:00
parent a3cf1ab0ca
commit 414d730962

View file

@ -75,7 +75,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
* @return the XmlStringBuilder * @return the XmlStringBuilder
*/ */
public XmlStringBuilder element(String name, String content) { public XmlStringBuilder element(String name, String content) {
assert content != null; if (content.isEmpty()) {
return emptyElement(name);
}
openElement(name); openElement(name);
escape(content); escape(content);
closeElement(name); closeElement(name);