1
0
Fork 0
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:
Florian Schmaus 2014-03-12 11:50:05 +01:00
parent 4b6f09f962
commit 4b56446e40
109 changed files with 2040 additions and 1599 deletions

View file

@ -20,9 +20,10 @@ package org.jivesoftware.smack;
import java.io.StringReader;
import org.jivesoftware.smack.sasl.SASLMechanism.Challenge;
import org.jivesoftware.smack.sasl.SASLMechanism.Failure;
import org.jivesoftware.smack.sasl.SASLMechanism.SASLFailure;
import org.jivesoftware.smack.sasl.SASLMechanism.Success;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smack.XMPPException.StreamErrorException;
import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlPullParser;
import org.igniterealtime.jbosh.AbstractBody;
@ -106,12 +107,12 @@ public class BOSHPacketReader implements BOSHClientResponseListener {
parseFeatures(parser);
} else if (parser.getName().equals("failure")) {
if ("urn:ietf:params:xml:ns:xmpp-sasl".equals(parser.getNamespace(null))) {
final Failure failure = PacketParserUtils.parseSASLFailure(parser);
connection.getSASLAuthentication().authenticationFailed(failure.getCondition());
final SASLFailure failure = PacketParserUtils.parseSASLFailure(parser);
connection.getSASLAuthentication().authenticationFailed(failure);
connection.processPacket(failure);
}
} else if (parser.getName().equals("error")) {
throw new XMPPException(PacketParserUtils.parseStreamError(parser));
throw new StreamErrorException(PacketParserUtils.parseStreamError(parser));
}
}
} while (eventType != XmlPullParser.END_DOCUMENT);