1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Improve message of XMPPErrorException

by including the XMPP entity which send the XMPP error reply to us.

Also cleanup the no longer used constructors.
This commit is contained in:
Florian Schmaus 2016-11-29 16:40:08 +01:00
parent 9165e818d9
commit d976434bb3
7 changed files with 65 additions and 57 deletions

View file

@ -280,7 +280,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
XMPPError.Builder error = XMPPError.from(XMPPError.Condition.item_not_found, errorMessage);
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
this.manager.getConnection().sendStanza(errorIQ);
throw new XMPPErrorException(error);
throw new XMPPErrorException(errorIQ, error.build());
}
/**

View file

@ -615,6 +615,7 @@ public final class AdHocCommandManager extends Manager {
* @return the command instance to execute.
* @throws XMPPErrorException if there is problem creating the new instance.
*/
@SuppressWarnings("deprecation")
private LocalCommand newInstanceOfCmd(String commandNode, String sessionID) throws XMPPErrorException
{
AdHocCommandInfo commandInfo = commands.get(commandNode);

View file

@ -327,7 +327,7 @@ public final class FileTransferNegotiator extends Manager {
}
else {
throw new XMPPErrorException(iqResponse.getError());
throw new XMPPErrorException(iqResponse, iqResponse.getError());
}
}
else {

View file

@ -30,7 +30,6 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jxmpp.jid.DomainBareJid;
import org.jxmpp.jid.EntityFullJid;
@ -113,8 +112,7 @@ public class ConnectionUtils {
public Stanza answer(InvocationOnMock invocation) throws Throwable {
Stanza packet = protocol.getResponses().poll();
if (packet == null) return packet;
XMPPError xmppError = packet.getError();
if (xmppError != null) throw new XMPPErrorException(xmppError);
XMPPErrorException.ifHasErrorThenThrow(packet);
return packet;
}
};