diff options
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.java | 16 |
1 files changed, 8 insertions, 8 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 bcc5e9dd..f3ac92dc 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java @@ -7,26 +7,26 @@ import de.thedevstack.conversationsplus.xmpp.exceptions.InternalServerErrorExcep import de.thedevstack.conversationsplus.xmpp.exceptions.IqPacketErrorException; import de.thedevstack.conversationsplus.xmpp.exceptions.ServiceUnavailableException; import de.thedevstack.conversationsplus.xmpp.exceptions.UndefinedConditionException; +import de.thedevstack.conversationsplus.xmpp.stanzas.ErrorIqPacket; +import de.thedevstack.conversationsplus.xmpp.stanzas.IqErrorCondition; /** - * Created by steckbrief on 22.08.2016. */ public final class ErrorIqPacketExceptionHelper { - private final static String ERROR_NAMESPACE = "urn:ietf:params:xml:ns:xmpp-stanzas"; public static void throwIqErrorException(Element errorIqPacket) throws IqPacketErrorException { Element packet = IqPacketParser.findChild(errorIqPacket, "error", "jabber:client"); if (null != packet) { - if (hasErrorElement(packet, "bad-request")) { + if (hasErrorElement(packet, IqErrorCondition.BAD_REQUEST.toString())) { throw new BadRequestIqErrorException(errorIqPacket, getErrorText(packet)); } - if (hasErrorElement(packet, "service-unavailable")) { + if (hasErrorElement(packet, IqErrorCondition.SERVICE_UNAVAILABLE.toString())) { throw new ServiceUnavailableException(errorIqPacket, getErrorText(packet)); } - if (hasErrorElement(packet, "internal-server-error")) { + if (hasErrorElement(packet, IqErrorCondition.INTERNAL_SERVER_ERROR.toString())) { throw new InternalServerErrorException(errorIqPacket, getErrorText(packet)); } - if (hasErrorElement(packet, "undefined-condition")) { + if (hasErrorElement(packet, IqErrorCondition.UNDEFINED_CONDITION.toString())) { throw new UndefinedConditionException(errorIqPacket, getErrorText(packet)); } } @@ -34,11 +34,11 @@ public final class ErrorIqPacketExceptionHelper { } private static boolean hasErrorElement(Element packet, String elementName) { - return null != IqPacketParser.findChild(packet, elementName, ERROR_NAMESPACE); + return null != IqPacketParser.findChild(packet, elementName, ErrorIqPacket.NAMESPACE); } private static String getErrorText(Element packet) { - return IqPacketParser.findChildContent(packet, "text", ERROR_NAMESPACE); + return IqPacketParser.findChildContent(packet, "text", ErrorIqPacket.NAMESPACE); } private ErrorIqPacketExceptionHelper() { |