mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-10 14:16:00 +01:00
SMACK-450 Make VCard.doLoad() return if the received packet was not an error and also not an VCard. Avoid calling VCard.load() with 'null' as argument.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_1@13713 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
d237e06dab
commit
4d1eaf522a
1 changed files with 12 additions and 10 deletions
|
@ -568,20 +568,22 @@ public class VCard extends IQ {
|
||||||
connection.sendPacket(this);
|
connection.sendPacket(this);
|
||||||
|
|
||||||
VCard result = null;
|
VCard result = null;
|
||||||
try {
|
Packet packet = collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||||
result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
|
||||||
|
|
||||||
if (result == null) {
|
if (packet == null) {
|
||||||
String errorMessage = "Timeout getting VCard information";
|
String errorMessage = "Timeout getting VCard information";
|
||||||
throw new XMPPException(errorMessage, new XMPPError(
|
throw new XMPPException(errorMessage, new XMPPError(XMPPError.Condition.request_timeout, errorMessage));
|
||||||
XMPPError.Condition.request_timeout, errorMessage));
|
|
||||||
}
|
}
|
||||||
if (result.getError() != null) {
|
if (packet.getError() != null) {
|
||||||
throw new XMPPException(result.getError());
|
throw new XMPPException(packet.getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
result = (VCard) packet;
|
||||||
}
|
}
|
||||||
catch (ClassCastException e) {
|
catch (ClassCastException e) {
|
||||||
System.out.println("No VCard for " + user);
|
System.out.println("No VCard for " + user);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyFieldsFrom(result);
|
copyFieldsFrom(result);
|
||||||
|
|
Loading…
Reference in a new issue