Skip to content

ZCU-PUB/SWORDv2 - Cannot update bitstream of archived Item #946

@milanmajchrak

Description

@milanmajchrak

How to replicate:

  1. Set the following configuration: plugin.single.org.dspace.sword2.WorkflowManager=org.dspace.sword2.WorkflowManagerUnrestricted
  2. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions