1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 05:52:06 +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:
Florian Schmaus 2013-07-12 22:54:03 +00:00 committed by flow
parent d237e06dab
commit 4d1eaf522a

View file

@ -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);