powered by Jive Software

"ConcurrentModificationException" while removing roster entries

“ConcurrentModificationException” Exception occurs when we loop through the Roster.getEntry() and Roster.removeEntry().

I tried to dig-out the cause for the same and found the following

  • “entries” object is synchronized while using in getEntry() method.

  • But when Roster listener receives roster removal packet then the entry is removed from “entries” object

  • While removing the roster entry from “entries” object this "entries"object should be synchronized.

I am using smack 2.2.1 build. But it seems that the issue is also persist with the latest release.

Please resolve the issue ASAP :-).



i solved a similar problem in another project by doing the following:

create a new vector this’ll be a temp storage for all objects that soulb be deleted

iterate over all objects and push all objects you want to delete to the tmp vector

after that’s done iterate over the tmp vector and delete all objects stored in there …

iv you delete something from a collection while iterating over it you’ll get those concurrent modification exceptions … the solution above sould avoic that.

Hi SmileJ,

Actually the list is accessed by two thread simulteniously in smack.

Your solution is not the good one.

I have resolved this issue in my smack build. I just want to infom the Jives people to file a bug for the same and get it fixed in the next release.


  • Just make the list object synchronized every where it is used.