aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-01-11 14:55:53 +0100
committersteckbrief <steckbrief@chefmail.de>2017-01-11 14:55:53 +0100
commit0a9bba28616e594279cd659ec2eb57da2074b3cd (patch)
treecb643f89080eee8745be1ee6590429488400f6c1 /src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
parent563fcfa77580292a7ff2360eea20553743bd0ae7 (diff)
Improved error handling for filetransfer:http:delete, Check for httpupload feature available extended to include filetransfer:http as well, method to check if http upload is available moved from data class 'Account' to 'AccountUtil'
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
index f02d8d46..bcc5e9dd 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
@@ -14,20 +14,23 @@ import de.thedevstack.conversationsplus.xmpp.exceptions.UndefinedConditionExcept
public final class ErrorIqPacketExceptionHelper {
private final static String ERROR_NAMESPACE = "urn:ietf:params:xml:ns:xmpp-stanzas";
- public static void throwIqErrorException(Element packet) throws IqPacketErrorException {
+ public static void throwIqErrorException(Element errorIqPacket) throws IqPacketErrorException {
+ Element packet = IqPacketParser.findChild(errorIqPacket, "error", "jabber:client");
+ if (null != packet) {
if (hasErrorElement(packet, "bad-request")) {
- throw new BadRequestIqErrorException(packet, getErrorText(packet));
+ throw new BadRequestIqErrorException(errorIqPacket, getErrorText(packet));
}
if (hasErrorElement(packet, "service-unavailable")) {
- throw new ServiceUnavailableException(packet, getErrorText(packet));
+ throw new ServiceUnavailableException(errorIqPacket, getErrorText(packet));
}
if (hasErrorElement(packet, "internal-server-error")) {
- throw new InternalServerErrorException(packet, getErrorText(packet));
+ throw new InternalServerErrorException(errorIqPacket, getErrorText(packet));
}
if (hasErrorElement(packet, "undefined-condition")) {
- throw new UndefinedConditionException(packet, getErrorText(packet));
+ throw new UndefinedConditionException(errorIqPacket, getErrorText(packet));
}
- throw new IqPacketErrorException(packet, "Unknown error packet.");
+ }
+ throw new IqPacketErrorException(errorIqPacket, "Unknown error packet.");
}
private static boolean hasErrorElement(Element packet, String elementName) {