From b0277d7e7452ac6ef9af352a962301e79133d11c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 30 Oct 2019 11:59:51 +0100 Subject: [PATCH] Emit as empty element when possible --- .../org/jivesoftware/smack/packet/StartTls.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java index 3da2c3a53..aebb1ad3f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2014-2018 Florian Schmaus + * Copyright © 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,9 +52,15 @@ public class StartTls implements Nonza { @Override public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); - xml.rightAngleBracket(); - xml.condEmptyElement(required, "required"); - xml.closeElement(this); + + if (required) { + xml.rightAngleBracket(); + xml.emptyElement("required"); + xml.closeElement(this); + } else { + xml.closeEmptyElement(); + } + return xml; }