mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Introduce SmackException
SmackException (and it's subclasses) is for all errors/exceptions not defined by any XMPP specification. XMPPException is now an abstract class for all errors defined by the XMPP specifications. Methods that involve an IQ exchange now either return the result, which is obtained by IQ response, or they throw an XMPPErrorException if an IQ error was the result of the IQ set/get. If there was no response from the server within the default packet timeout, a NoResponseException will be thrown. XMPP SASL errors are now also reported accordingly. SMACK-426
This commit is contained in:
parent
4b6f09f962
commit
4b56446e40
109 changed files with 2040 additions and 1599 deletions
|
@ -20,8 +20,9 @@ import static org.mockito.Matchers.*;
|
|||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.jivesoftware.smack.PacketCollector;
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
|
@ -57,10 +58,11 @@ public class ConnectionUtils {
|
|||
* @param initiatorJID the user associated to the XMPP connection
|
||||
* @param xmppServer the XMPP server associated to the XMPP connection
|
||||
* @return a mocked XMPP connection
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws XMPPErrorException
|
||||
*/
|
||||
public static XMPPConnection createMockedConnection(final Protocol protocol,
|
||||
String initiatorJID, String xmppServer) throws XMPPException {
|
||||
String initiatorJID, String xmppServer) throws SmackException, XMPPErrorException {
|
||||
|
||||
// mock XMPP connection
|
||||
XMPPConnection connection = mock(XMPPConnection.class);
|
||||
|
@ -105,7 +107,7 @@ public class ConnectionUtils {
|
|||
Packet packet = protocol.getResponses().poll();
|
||||
if (packet == null) return packet;
|
||||
XMPPError xmppError = packet.getError();
|
||||
if (xmppError != null) throw new XMPPException(xmppError);
|
||||
if (xmppError != null) throw new XMPPErrorException(xmppError);
|
||||
return packet;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue