1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Change Element.toXml() to toXml(String enclosingNamespace)

This commit is contained in:
Florian Schmaus 2018-04-25 14:20:18 +02:00
parent 380f9a2b72
commit 5ab2903c32
229 changed files with 634 additions and 536 deletions

View file

@ -37,7 +37,7 @@ public abstract class OmemoBundleElement implements ExtensionElement {
public static final String PRE_KEY_ID = "preKeyId";
@Override
public abstract XmlStringBuilder toXML();
public abstract XmlStringBuilder toXML(String enclosingNamespace);
@Override
public boolean equals(Object other) {
@ -46,11 +46,11 @@ public abstract class OmemoBundleElement implements ExtensionElement {
}
OmemoBundleElement otherOmemoBundleElement = (OmemoBundleElement) other;
return toXML().equals(otherOmemoBundleElement.toXML());
return toXML(null).equals(otherOmemoBundleElement.toXML(null));
}
@Override
public int hashCode() {
return this.toXML().hashCode();
return this.toXML(null).hashCode();
}
}

View file

@ -166,7 +166,7 @@ public class OmemoBundleVAxolotlElement extends OmemoBundleElement {
}
@Override
public XmlStringBuilder toXML() {
public XmlStringBuilder toXML(String enclosingNamespace) {
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
sb.halfOpenElement(SIGNED_PRE_KEY_PUB).attribute(SIGNED_PRE_KEY_ID, signedPreKeyId).rightAngleBracket()

View file

@ -59,7 +59,7 @@ public abstract class OmemoDeviceListElement implements ExtensionElement {
}
@Override
public final XmlStringBuilder toXML() {
public final XmlStringBuilder toXML(String enclosingNamespace) {
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
for (Integer id : deviceIds) {

View file

@ -120,7 +120,7 @@ public abstract class OmemoElement implements ExtensionElement {
}
@Override
public CharSequence toXML() {
public CharSequence toXML(String enclosingNamespace) {
XmlStringBuilder sb = new XmlStringBuilder(this);
sb.attribute(SID, getSid()).rightAngleBracket();
@ -176,7 +176,7 @@ public abstract class OmemoElement implements ExtensionElement {
}
@Override
public CharSequence toXML() {
public CharSequence toXML(String enclosingNamespace) {
XmlStringBuilder sb = new XmlStringBuilder(this);
if (isPreKey()) {

View file

@ -47,7 +47,7 @@ public class OmemoVAxolotlElement extends OmemoElement {
}
@Override
public XmlStringBuilder toXML() {
public XmlStringBuilder toXML(String enclosingNamespace) {
XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket();
sb.element(header);

View file

@ -76,7 +76,7 @@ public class OmemoBundleVAxolotlElementTest extends SmackTestSuite {
"</preKeyPublic>" +
"</prekeys>" +
"</bundle>";
String actual = bundle.toXML().toString();
String actual = bundle.toXML(null).toString();
assertEquals("Bundles XML must match.", expected, actual);
byte[] signedPreKey = "SignedPreKey".getBytes(StringUtils.UTF8);

View file

@ -42,7 +42,7 @@ public class OmemoDeviceListVAxolotlElementTest extends SmackTestSuite {
ids.add(9876);
OmemoDeviceListVAxolotlElement element = new OmemoDeviceListVAxolotlElement(ids);
String xml = element.toXML().toString();
String xml = element.toXML(null).toString();
XmlPullParser parser = TestUtils.getParser(xml);
OmemoDeviceListVAxolotlElement parsed = new OmemoDeviceListVAxolotlProvider().parse(parser);

View file

@ -66,10 +66,10 @@ public class OmemoVAxolotlElementTest extends SmackTestSuite {
"</payload>" +
"</encrypted>";
String actual = element.toXML().toString();
String actual = element.toXML(null).toString();
assertEquals("Serialized xml of OmemoElement must match.", expected, actual);
OmemoVAxolotlElement parsed = new OmemoVAxolotlProvider().parse(TestUtils.getParser(actual));
assertEquals("Parsed OmemoElement must equal the original.", element.toXML().toString(), parsed.toXML().toString());
assertEquals("Parsed OmemoElement must equal the original.", element.toXML(null).toString(), parsed.toXML(null).toString());
}
}