mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Add XMPPErrorException.getStanzaError()
Also deprecate getXMPPError and let StanzaError implement ExtensionElement.
This commit is contained in:
parent
651ee7b85e
commit
23bb5c5625
31 changed files with 108 additions and 75 deletions
|
@ -211,7 +211,7 @@ public class StreamManagement {
|
|||
}
|
||||
}
|
||||
|
||||
public StanzaError.Condition getXMPPErrorCondition() {
|
||||
public StanzaError.Condition getStanzaErrorCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ public class StreamManagement {
|
|||
if (condition != null) {
|
||||
xml.rightAngleBracket();
|
||||
xml.append(condition.toString());
|
||||
xml.xmlnsAttribute(StanzaError.NAMESPACE);
|
||||
xml.xmlnsAttribute(StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE);
|
||||
xml.closeEmptyElement();
|
||||
}
|
||||
xml.append(textElements);
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ParseStreamManagement {
|
|||
case XmlPullParser.START_TAG:
|
||||
name = parser.getName();
|
||||
String namespace = parser.getNamespace();
|
||||
if (StanzaError.NAMESPACE.equals(namespace)) {
|
||||
if (StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE.equals(namespace)) {
|
||||
if (name.equals(AbstractTextElement.ELEMENT)) {
|
||||
String lang = ParserUtils.getXmlLang(parser);
|
||||
String text = parser.nextText();
|
||||
|
|
|
@ -1139,7 +1139,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
break;
|
||||
case Failed.ELEMENT:
|
||||
Failed failed = ParseStreamManagement.failed(parser);
|
||||
FailedNonzaException xmppException = new FailedNonzaException(failed, failed.getXMPPErrorCondition());
|
||||
FailedNonzaException xmppException = new FailedNonzaException(failed, failed.getStanzaErrorCondition());
|
||||
// If only XEP-198 would specify different failure elements for the SM
|
||||
// enable and SM resume failure case. But this is not the case, so we
|
||||
// need to determine if this is a 'Failed' response for either 'Enable'
|
||||
|
|
|
@ -85,7 +85,7 @@ public class ParseStreamManagementTest {
|
|||
PacketParserUtils.getParserFor(failedStanza));
|
||||
|
||||
assertThat(failedPacket, is(notNullValue()));
|
||||
assertTrue(failedPacket.getXMPPErrorCondition() == null);
|
||||
assertTrue(failedPacket.getStanzaErrorCondition() == null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -94,14 +94,14 @@ public class ParseStreamManagementTest {
|
|||
|
||||
String failedStanza = XMLBuilder.create("failed")
|
||||
.a("xmlns", "urn:xmpp:sm:3")
|
||||
.element(errorCondition.toString(), StanzaError.NAMESPACE)
|
||||
.element(errorCondition.toString(), StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE)
|
||||
.asString(outputProperties);
|
||||
|
||||
StreamManagement.Failed failedPacket = ParseStreamManagement.failed(
|
||||
PacketParserUtils.getParserFor(failedStanza));
|
||||
|
||||
assertThat(failedPacket, is(notNullValue()));
|
||||
assertTrue(failedPacket.getXMPPErrorCondition() == errorCondition);
|
||||
assertTrue(failedPacket.getStanzaErrorCondition() == errorCondition);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -118,7 +118,7 @@ public class ParseStreamManagementTest {
|
|||
|
||||
StreamManagement.Failed failed = ParseStreamManagement.failed(parser);
|
||||
|
||||
assertEquals(StanzaError.Condition.item_not_found, failed.getXMPPErrorCondition());
|
||||
assertEquals(StanzaError.Condition.item_not_found, failed.getStanzaErrorCondition());
|
||||
|
||||
List<StanzaErrorTextElement> textElements = failed.getTextElements();
|
||||
assertEquals(1, textElements.size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue