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 15:50:13 +0100
committersteckbrief <steckbrief@chefmail.de>2017-01-11 15:50:13 +0100
commit44d01d933c0434b0e9b6ce7a1ff888f1b0f2ef3d (patch)
tree1f0ebdcab4824b53a7f0507d69088efd9456db84 /src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
parentc76d0968b8874c0e4466b4e315688a7d003d52f6 (diff)
parentcd633f13b8d7327e47994bb5a000f0c0b7089e7f (diff)
Merge branch 'trz/rename' into trz/rebase
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.java29
1 files changed, 16 insertions, 13 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 15771248..93e525a8 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java
@@ -15,20 +15,23 @@ import eu.siacs.conversations.xml.Element;
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 {
- if (hasErrorElement(packet, "bad-request")) {
- throw new BadRequestIqErrorException(packet, getErrorText(packet));
+ 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(errorIqPacket, getErrorText(packet));
+ }
+ if (hasErrorElement(packet, "service-unavailable")) {
+ throw new ServiceUnavailableException(errorIqPacket, getErrorText(packet));
+ }
+ if (hasErrorElement(packet, "internal-server-error")) {
+ throw new InternalServerErrorException(errorIqPacket, getErrorText(packet));
+ }
+ if (hasErrorElement(packet, "undefined-condition")) {
+ throw new UndefinedConditionException(errorIqPacket, getErrorText(packet));
+ }
}
- if (hasErrorElement(packet, "service-unavailable")) {
- throw new ServiceUnavailableException(packet, getErrorText(packet));
- }
- if (hasErrorElement(packet, "internal-server-error")) {
- throw new InternalServerErrorException(packet, getErrorText(packet));
- }
- if (hasErrorElement(packet, "undefined-condition")) {
- throw new UndefinedConditionException(packet, getErrorText(packet));
- }
- throw new IqPacketErrorException(packet, "Unknown error packet.");
+ throw new IqPacketErrorException(errorIqPacket, "Unknown error packet.");
}
private static boolean hasErrorElement(Element packet, String elementName) {