Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.dspace.app.rest.exception.ClarinLicenseNotFoundException;
import org.dspace.app.rest.exception.UnprocessableEntityException;
import org.dspace.app.rest.model.patch.JsonValueEvaluator;
Expand Down Expand Up @@ -87,14 +86,11 @@ public void doPatchProcessing(Context context, HttpServletRequest currentRequest
"The operation '" + op.getOp() + "' is not supported for path " + path);
}
String licenseName = extractLicenseName(op);
// Section endpoint: a missing or blank license name is treated as a
// client error (422). The legacy `/license` path in
// WorkspaceItemRestRepository intentionally treats a blank value as
// "clear the current license" for backwards compatibility.
if (StringUtils.isBlank(licenseName)) {
throw new UnprocessableEntityException(
"The patch value for path " + path + " must contain a non-empty license name.");
}
// A blank/missing license name is intentionally treated as a request
// to clear the currently selected CLARIN license, mirroring the
// legacy `/license` path in WorkspaceItemRestRepository.
// {@link ClarinLicenseSubmissionUtils#applyLicense} handles a blank
// name as a "clear" operation.
try {
ClarinLicenseSubmissionUtils.applyLicense(context, source.getItem(), licenseName);
} catch (ClarinLicenseNotFoundException ex) {
Expand Down
Loading