mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +01:00
Improve XmlStringBuilder usage in Bytestream
This commit is contained in:
parent
6021f8a8ce
commit
650da55b23
1 changed files with 6 additions and 8 deletions
|
@ -221,17 +221,13 @@ public class Bytestream extends IQ {
|
||||||
@Override
|
@Override
|
||||||
public XmlStringBuilder getChildElementXML() {
|
public XmlStringBuilder getChildElementXML() {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder();
|
XmlStringBuilder xml = new XmlStringBuilder();
|
||||||
xml.halfOpenElement(IQ.QUERY_ELEMENT);
|
xml.halfOpenElement(QUERY_ELEMENT);
|
||||||
xml.xmlnsAttribute(NAMESPACE);
|
xml.xmlnsAttribute(NAMESPACE);
|
||||||
|
|
||||||
switch(getType()) {
|
switch(getType()) {
|
||||||
case set:
|
case set:
|
||||||
if (getSessionID() != null) {
|
xml.optAttribute("sid", getSessionID());
|
||||||
xml.attribute("sid", getSessionID());
|
xml.optAttribute("mode", getMode());
|
||||||
}
|
|
||||||
if (getMode() != null) {
|
|
||||||
xml.attribute("mode", getMode());
|
|
||||||
}
|
|
||||||
xml.rightAngelBracket();
|
xml.rightAngelBracket();
|
||||||
if (getToActivate() == null) {
|
if (getToActivate() == null) {
|
||||||
for (StreamHost streamHost : getStreamHosts()) {
|
for (StreamHost streamHost : getStreamHosts()) {
|
||||||
|
@ -256,11 +252,13 @@ public class Bytestream extends IQ {
|
||||||
break;
|
break;
|
||||||
case get:
|
case get:
|
||||||
xml.closeEmptyElement();
|
xml.closeEmptyElement();
|
||||||
|
// Return here so that we don't run into the
|
||||||
|
// closeElement(QUERY_ELEMNT) section
|
||||||
return xml;
|
return xml;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
xml.closeElement(IQ.QUERY_ELEMENT);
|
xml.closeElement(QUERY_ELEMENT);
|
||||||
|
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue