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
1 changed files with 11 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.StanzaError;
import org.jivesoftware.smack.roster.AbstractPresenceEventListener;
import org.jivesoftware.smack.roster.PresenceEventListener;
import org.jivesoftware.smack.roster.Roster;
@ -99,7 +100,16 @@ public class IntegrationTestRosterUtil {
if (c2Entry == null) {
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;
}
}
}