mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-24 03:27:59 +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
|
||||
packetWriter.sendPacket(discoveryAuth);
|
||||
// Wait up to five seconds for a response from the server.
|
||||
Authentication authTypes = (Authentication)collector.nextResult(5000);
|
||||
collector.cancel();
|
||||
if (authTypes == null) {
|
||||
IQ response = (IQ)collector.nextResult(5000);
|
||||
if (response == null) {
|
||||
throw new XMPPException("No response from the server.");
|
||||
}
|
||||
else if (authTypes.getType().equals(IQ.Type.ERROR)) {
|
||||
throw new XMPPException(authTypes.getError());
|
||||
// If the server replied with an error, throw an exception.
|
||||
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.
|
||||
Authentication auth = new Authentication();
|
||||
|
@ -290,7 +293,7 @@ public class XMPPConnection {
|
|||
// Send the packet.
|
||||
packetWriter.sendPacket(auth);
|
||||
// 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) {
|
||||
throw new XMPPException("Authentication failed.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue