diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/xmpp/httpupload/SlotPacketParser.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/httpupload/SlotPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/httpupload/SlotPacketParser.java index 0630449a..655d8759 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/httpupload/SlotPacketParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/httpupload/SlotPacketParser.java @@ -1,27 +1,30 @@ package de.thedevstack.conversationsplus.xmpp.httpupload; import de.thedevstack.conversationsplus.xml.Element; -import de.thedevstack.conversationsplus.xmpp.AbstractIqPacketParser; +import de.thedevstack.conversationsplus.xmpp.IqPacketParser; import de.thedevstack.conversationsplus.xmpp.exceptions.UnexpectedIqPacketTypeException; import de.thedevstack.conversationsplus.xmpp.exceptions.XmppException; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; +import de.thedevstack.conversationsplus.xmpp.utils.ErrorIqPacketExceptionHelper; /** * */ -public final class SlotPacketParser extends AbstractIqPacketParser { +public final class SlotPacketParser extends IqPacketParser { public static HttpUploadSlot parseGetAndPutUrl(IqPacket packet) throws XmppException { + HttpUploadSlot httpUploadSlot = null; if (packet.getType() == IqPacket.TYPE.RESULT) { Element slot = findRequiredChild(packet, "slot", HttpUpload.NAMESPACE); String getUrl = findRequiredChildContent(slot, "get"); String putUrl = findRequiredChildContent(slot, "put"); - return new HttpUploadSlot(getUrl, putUrl); + httpUploadSlot = new HttpUploadSlot(getUrl, putUrl); } else if (packet.getType() == IqPacket.TYPE.ERROR) { - throw new XmppException(); // Do proper handling of error cases + ErrorIqPacketExceptionHelper.throwIqErrorException(packet); } else { throw new UnexpectedIqPacketTypeException(packet, packet.getType(), IqPacket.TYPE.RESULT, IqPacket.TYPE.ERROR); } + return httpUploadSlot; } } |