diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-08-07 12:57:57 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-08-07 12:57:57 +0200 |
commit | a892bb6f1685b84b74ba37e5a6a24ee8fb45eee7 (patch) | |
tree | f6d8036841f961dd987c2fb48e41983b327be049 /src/main/java/de/thedevstack/conversationsplus/xmpp/utils/ErrorIqPacketExceptionHelper.java | |
parent | be1992ce897d3b0551e545646a3e0f45cc6dd8c2 (diff) |
Simplifying introduction of new XEP implementations, implements FS#250 and FS#251 (Privacy and Security settings), refactoring of location of some interfaces
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() { |