65997: ReplacePatchOperation function moved to subclasses &

EPersonOperationFactory removed, no longer useful
TODO: fix failing tests of replace in two operations
This commit is contained in:
Marie Verdonck
2019-11-06 20:12:49 +01:00
parent e8fe89581f
commit 8af15603ef
16 changed files with 406 additions and 200 deletions

View File

@@ -691,9 +691,11 @@ public abstract class DSpaceObjectServiceImpl<T extends DSpaceObject> implements
List<MetadataValue> list = getMetadata(dso, schema, element, qualifier);
if (from >= list.size()) {
if (from >= list.size() || to >= list.size() || to < 0 || from < 0) {
throw new IllegalArgumentException(
"The \"from\" location MUST exist for the operation to be successful. Idx:" + from);
"The \"from\" and \"to\" locations MUST exist for the operation to be successful." +
"\n To and from indices must be between 0 and " + (list.size() - 1) +
"\n Idx from:" + from + " Idx to: " + to);
}
clearMetadata(context, dso, schema, element, qualifier, Item.ANY);