-
Notifications
You must be signed in to change notification settings - Fork 2
Description
How to replicate:
- Set the following configuration:
plugin.single.org.dspace.sword2.WorkflowManager=org.dspace.sword2.WorkflowManagerUnrestricted - Run the following command:
curl -i --data-binary "@newfile.zip" -H "Content-Disposition: attachment; filename=newfile.zip" -H "Content-Type: application/zip" -u <EMAIL>:<PASSWORD> -X PUT <HOST_URL>swordv2/edit-media/<ITEMS_UUID>
Observed error:
ConcurrentModificationException is thrown when processing an ArrayList.
This typically happens when the list is modified (e.g., by adding or removing elements) while iterating over it using an iterator or an enhanced for loop.
In this case, the ArrayList of bundle iterators is modified during bundle processing.
Root cause:
In the method flow:
https://github.com/dataquest-dev/DSpace/blob/dtq-dev/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java#L51 -> https://github.com/dataquest-dev/DSpace/blob/dtq-dev/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java#L68 -> https://github.com/dataquest-dev/DSpace/blob/dtq-dev/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java#L159 A new bundle is created during iteration over the existing bundles in a while loop.
Since the ArrayList of bundles is being modified (by adding a new bundle) during iteration, a ConcurrentModificationException is thrown.