From 6a1d7aa28d7dc6f60fdde05b10a60e7e63e82376 Mon Sep 17 00:00:00 2001 From: Paurikova2 <107862249+Paurikova2@users.noreply.github.com> Date: Mon, 2 Sep 2024 08:35:04 +0200 Subject: [PATCH] Cannot create a new version because an owningcollection is null (#731) * control if owning collection is null --- dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java b/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java index ff566d598f25..1db31bcf8d47 100644 --- a/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java +++ b/dspace-oai/src/main/java/org/dspace/xoai/util/ItemUtils.java @@ -401,7 +401,10 @@ public static Metadata retrieveMetadata(Context context, Item item) { if (restricted) { other.getField().add(createValue("restrictedAccess", "true")); } - other.getField().add(createValue("owningCollection", item.getOwningCollection().getName())); + // Because we reindex Solr, which is not done in vanilla + // The owning collection for workspace items is null + other.getField().add(createValue("owningCollection", + item.getOwningCollection() != null ? item.getOwningCollection().getName() : null)); other.getField().add(createValue("itemId", item.getID().toString())); metadata.getElement().add(other);