From 194b099902132d50b4ae961fbd427f2b69f05541 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Wed, 17 Jul 2024 12:33:17 -0400 Subject: [PATCH] an extra null check on TermsOfUse - this should fix #10513 for datasets harvested in oai_dc, and not break anything else... I think? #8796 --- .../edu/harvard/iq/dataverse/search/IndexServiceBean.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java index 78bc80a798d..c91eb0bfa7c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java @@ -1849,8 +1849,12 @@ private void addLicenseToSolrDoc(SolrInputDocument solrInputDocument, DatasetVer } String licenseName = "Custom Terms"; - if(datasetVersion.getTermsOfUseAndAccess().getLicense() != null) { + if (datasetVersion.getTermsOfUseAndAccess().getLicense() != null) { licenseName = datasetVersion.getTermsOfUseAndAccess().getLicense().getName(); + } else if (datasetVersion.getTermsOfUseAndAccess().getTermsOfUse() == null) { + // this fixes #10513 for datasets harvested in oai_dc - these + // have neither the license id, nor any actual custom terms + return; } solrInputDocument.addField(SearchFields.DATASET_LICENSE, licenseName); }