View Full Version : [CLOSED] ConcurrentModificationException when removing a BaseModel element from list

5 Jan 2011, 8:16 AM
I'm trying to remove an element from a list of BaseModel but I'm getting a java.util.ConcurrentModificationException.

Is there a Bug here or am I doing something wrong ?

- GXT 2.2.1
- Linux Ubuntu 10.10
- Firefox 3.6
- Hosted mode

Note : BeanGXTMagasin extends BaseModel

public void onSuccess(final List<BeanGXTMagasin> magasins) {

final ListStore<BeanGXTMagasin> store = new ListStore<BeanGXTMagasin>();

for (BeanGXTMagasin bean : magasins) { //*** java.util.ConcurrentModificationException: null
if (bean.getFlagModif().equals("U")) {
} else if (bean.getFlagModif().equals("I")) {
} else if (bean.getFlagModif().equals("D")) {
magasins.remove(bean); //*** when this fired at the previous iteration

5 Jan 2011, 12:29 PM
This is not an issue in GXT but in your code. You cannot remove something from your list while iterating over it with the default iterator. This is exactly what the exception tells you.