mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
Prevent concurrent modification exception
This commit is contained in:
@@ -561,10 +561,16 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
|
|||||||
{
|
{
|
||||||
if (!isTest)
|
if (!isTest)
|
||||||
{
|
{
|
||||||
|
ArrayList<Collection> removeList = new ArrayList<>();
|
||||||
List<Collection> collections = myitem.getCollections();
|
List<Collection> collections = myitem.getCollections();
|
||||||
|
|
||||||
// Remove item from all the collections it's in
|
// Save items to be removed to prevent concurrent modification exception DS-3322
|
||||||
for (Collection collection : collections) {
|
for (Collection collection : collections) {
|
||||||
|
removeList.add(collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove item from all the collections it's in
|
||||||
|
for (Collection collection : removeList) {
|
||||||
collectionService.removeItem(c, collection, myitem);
|
collectionService.removeItem(c, collection, myitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user