Hi Sebastian,

I am using the method #ListUtils.move to sort a list of domain objects as soon 
as the method #onUpdate is called within a sortable object:
In the first request, everything is fine, but in the second request I am 
receiving following error:
Root cause:

java.util.ConcurrentModificationException
     at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
     at java.util.ArrayList$Itr.next(ArrayList.java:851)

Can you give me a hint why this error occurs and how to fix it?

@Override
public void onUpdate(AjaxRequestTarget target, String item, int index) {
    super.onUpdate(target, item, index);
    user.sortObj(item, index);

}
*****************************
Class User:
private final List<Item> selectedItems = Lists.newArrayList();
public void sortItems(String itemName, int index) {
    for (Item currentItem : selectedItems) {
      if (itemName.equals(currentItem.getName())) {
          ListUtils.move(currentItem, index, selectedItems);
      }
    }
}

Thanks a lot,
Chris

Reply via email to