mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 15:32: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:
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);
|
||||
|
||||
VCard result = null;
|
||||
try {
|
||||
result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||
Packet packet = collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||
|
||||
if (result == null) {
|
||||
String errorMessage = "Timeout getting VCard information";
|
||||
throw new XMPPException(errorMessage, new XMPPError(
|
||||
XMPPError.Condition.request_timeout, errorMessage));
|
||||
}
|
||||
if (result.getError() != null) {
|
||||
throw new XMPPException(result.getError());
|
||||
}
|
||||
if (packet == null) {
|
||||
String errorMessage = "Timeout getting VCard information";
|
||||
throw new XMPPException(errorMessage, new XMPPError(XMPPError.Condition.request_timeout, errorMessage));
|
||||
}
|
||||
if (packet.getError() != null) {
|
||||
throw new XMPPException(packet.getError());
|
||||
}
|
||||
|
||||
try {
|
||||
result = (VCard) packet;
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
System.out.println("No VCard for " + user);
|
||||
return;
|
||||
}
|
||||
|
||||
copyFieldsFrom(result);
|
||||
|
|
Loading…
Reference in a new issue