1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-08 06:01:07 +01:00

Add XMPPErrorException.getStanzaError()

Also deprecate getXMPPError and let StanzaError implement
ExtensionElement.
This commit is contained in:
Florian Schmaus 2018-06-20 15:55:48 +02:00
parent 651ee7b85e
commit 23bb5c5625
31 changed files with 108 additions and 75 deletions

View file

@ -460,7 +460,7 @@ public final class AdHocCommandManager extends Manager {
// If there is an exception caused by the next, complete,
// prev or cancel method, then that error is returned to the
// requester.
StanzaError error = e.getXMPPError();
StanzaError error = e.getStanzaError();
// If the error type is cancel, then the execution is
// canceled therefore the status must show that, and the
@ -570,7 +570,7 @@ public final class AdHocCommandManager extends Manager {
// If there is an exception caused by the next, complete,
// prev or cancel method, then that error is returned to the
// requester.
StanzaError error = e.getXMPPError();
StanzaError error = e.getStanzaError();
// If the error type is cancel, then the execution is
// canceled therefore the status must show that, and the

View file

@ -344,7 +344,7 @@ public class OutgoingFileTransfer extends FileTransfer {
}
private void handleXMPPException(XMPPErrorException e) {
StanzaError error = e.getXMPPError();
StanzaError error = e.getStanzaError();
if (error != null) {
switch (error.getCondition()) {
case forbidden:

View file

@ -221,7 +221,7 @@ public final class PrivateDataManager extends Manager {
return true;
}
catch (XMPPErrorException e) {
if (e.getXMPPError().getCondition() == Condition.service_unavailable) {
if (e.getStanzaError().getCondition() == Condition.service_unavailable) {
return false;
}
else {

View file

@ -149,7 +149,7 @@ public final class PingManager extends Manager {
return true;
}
final StanzaError xmppError = xmppErrorException.getXMPPError();
final StanzaError xmppError = xmppErrorException.getStanzaError();
// We may received an error response from an intermediate service returning an error like
// 'remote-server-not-found' or 'remote-server-timeout' to us (which would fake the 'from' address,

View file

@ -276,12 +276,12 @@ public final class PubSubManager extends Manager {
return createNode(id);
}
catch (XMPPErrorException e1) {
if (e1.getXMPPError().getCondition() == Condition.item_not_found) {
if (e1.getStanzaError().getCondition() == Condition.item_not_found) {
try {
return createNode(id);
}
catch (XMPPErrorException e2) {
if (e2.getXMPPError().getCondition() == Condition.conflict) {
if (e2.getStanzaError().getCondition() == Condition.conflict) {
// The node was created in the meantime, re-try getNode(). Note that this case should be rare.
try {
return getNode(id);
@ -294,7 +294,7 @@ public final class PubSubManager extends Manager {
throw e2;
}
}
if (e1.getXMPPError().getCondition() == Condition.service_unavailable) {
if (e1.getStanzaError().getCondition() == Condition.service_unavailable) {
// This could be caused by Prosody bug #805 (see https://prosody.im/issues/issue/805). Prosody does not
// answer to disco#info requests on the node ID, which makes it undecidable if a node is a leaf or
// collection node.
@ -326,7 +326,7 @@ public final class PubSubManager extends Manager {
node = getNode(id);
}
catch (XMPPErrorException e) {
if (e.getXMPPError().getCondition() == Condition.service_unavailable) {
if (e.getStanzaError().getCondition() == Condition.service_unavailable) {
// This could be caused by Prosody bug #805 (see https://prosody.im/issues/issue/805). Prosody does not
// answer to disco#info requests on the node ID, which makes it undecidable if a node is a leaf or
// collection node.
@ -349,7 +349,7 @@ public final class PubSubManager extends Manager {
// Try to ensure that this is not a collection node by asking for one item form the node.
leafNode.getItems(1);
} catch (XMPPErrorException e) {
Condition condition = e.getXMPPError().getCondition();
Condition condition = e.getStanzaError().getCondition();
if (condition == Condition.feature_not_implemented) {
// XEP-0060 § 6.5.9.5: Item retrieval not supported, e.g. because node is a collection node
throw new PubSubException.NotALeafNodeException(id, pubSubService);
@ -369,7 +369,7 @@ public final class PubSubManager extends Manager {
return createNode(id);
}
catch (XMPPErrorException e1) {
if (e1.getXMPPError().getCondition() == Condition.conflict) {
if (e1.getStanzaError().getCondition() == Condition.conflict) {
return getLeafNodeProsodyWorkaround(id);
}
throw e1;
@ -556,7 +556,7 @@ public final class PubSubManager extends Manager {
leafNode = createNode();
}
catch (XMPPErrorException e) {
if (e.getXMPPError().getCondition() == StanzaError.Condition.forbidden) {
if (e.getStanzaError().getCondition() == StanzaError.Condition.forbidden) {
return false;
}
throw e;