mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 15:32:06 +01:00
Fix for ClassCastException with bad username.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1858 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
7bc473fd24
commit
36e0744c60
1 changed files with 9 additions and 6 deletions
|
@ -259,14 +259,17 @@ public class XMPPConnection {
|
||||||
// Send the packet
|
// Send the packet
|
||||||
packetWriter.sendPacket(discoveryAuth);
|
packetWriter.sendPacket(discoveryAuth);
|
||||||
// Wait up to five seconds for a response from the server.
|
// Wait up to five seconds for a response from the server.
|
||||||
Authentication authTypes = (Authentication)collector.nextResult(5000);
|
IQ response = (IQ)collector.nextResult(5000);
|
||||||
collector.cancel();
|
if (response == null) {
|
||||||
if (authTypes == null) {
|
|
||||||
throw new XMPPException("No response from the server.");
|
throw new XMPPException("No response from the server.");
|
||||||
}
|
}
|
||||||
else if (authTypes.getType().equals(IQ.Type.ERROR)) {
|
// If the server replied with an error, throw an exception.
|
||||||
throw new XMPPException(authTypes.getError());
|
else if (response.getType() == IQ.Type.ERROR) {
|
||||||
|
throw new XMPPException(response.getError());
|
||||||
}
|
}
|
||||||
|
// Otherwise, no error so continue processing.
|
||||||
|
Authentication authTypes = (Authentication)response;
|
||||||
|
collector.cancel();
|
||||||
|
|
||||||
// Now, create the authentication packet we'll send to the server.
|
// Now, create the authentication packet we'll send to the server.
|
||||||
Authentication auth = new Authentication();
|
Authentication auth = new Authentication();
|
||||||
|
@ -290,7 +293,7 @@ public class XMPPConnection {
|
||||||
// Send the packet.
|
// Send the packet.
|
||||||
packetWriter.sendPacket(auth);
|
packetWriter.sendPacket(auth);
|
||||||
// Wait up to five seconds for a response from the server.
|
// Wait up to five seconds for a response from the server.
|
||||||
IQ response = (IQ)collector.nextResult(5000);
|
response = (IQ)collector.nextResult(5000);
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
throw new XMPPException("Authentication failed.");
|
throw new XMPPException("Authentication failed.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue