1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-14 19:49:38 +02:00

Fix UOE being thrown in BlockingCommandManager

the manager must use a copy of the BlockListIQ's JID list, since it may
be the empty list which is not modifiable.

Also rename the getter methods from getJids() to getBlockedJids().
This commit is contained in:
Florian Schmaus 2016-11-23 17:52:04 +01:00
parent da58b20b53
commit 1b1e88c4c3
3 changed files with 21 additions and 10 deletions

View file

@ -47,13 +47,13 @@ public class GetBlockingListTest {
public void checkBlockListIQ() throws Exception {
IQ iq = (IQ) PacketParserUtils.parseStanza(blockListIQExample);
BlockListIQ blockListIQ = (BlockListIQ) iq;
Assert.assertEquals(2, blockListIQ.getJids().size());
Assert.assertEquals(JidCreate.from("romeo@montague.net"), blockListIQ.getJids().get(0));
Assert.assertEquals(JidCreate.from("iago@shakespeare.lit"), blockListIQ.getJids().get(1));
Assert.assertEquals(2, blockListIQ.getBlockedJids().size());
Assert.assertEquals(JidCreate.from("romeo@montague.net"), blockListIQ.getBlockedJids().get(0));
Assert.assertEquals(JidCreate.from("iago@shakespeare.lit"), blockListIQ.getBlockedJids().get(1));
IQ iq2 = (IQ) PacketParserUtils.parseStanza(emptyBlockListIQExample);
BlockListIQ emptyBlockListIQ = (BlockListIQ) iq2;
Assert.assertEquals(0, emptyBlockListIQ.getJids().size());
Assert.assertEquals(0, emptyBlockListIQ.getBlockedJids().size());
}
}