1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Merge pull request #480 from guusdk/sint_improve-notinroster

[sint] increase stability
This commit is contained in:
Florian Schmaus 2021-11-04 09:46:18 +01:00 committed by GitHub
commit f611941dcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.roster.AbstractPresenceEventListener; import org.jivesoftware.smack.roster.AbstractPresenceEventListener;
import org.jivesoftware.smack.roster.PresenceEventListener; import org.jivesoftware.smack.roster.PresenceEventListener;
import org.jivesoftware.smack.roster.Roster; import org.jivesoftware.smack.roster.Roster;
@ -99,7 +100,16 @@ public class IntegrationTestRosterUtil {
if (c2Entry == null) { if (c2Entry == null) {
return; return;
} }
roster.removeEntry(c2Entry); try {
roster.removeEntry(c2Entry);
} catch (XMPPErrorException e) {
// Account for race conditions: server-sided, the item might already have been removed.
if (e.getStanzaError().getCondition() == StanzaError.Condition.item_not_found) {
// Trying to remove non-existing item. As it needs to be gone, this is fine.
return;
}
throw e;
}
} }
} }