From aef2bdcb1c3ef676f425666a5d9387dd9e77621c Mon Sep 17 00:00:00 2001 From: Oliver Goldschmidt Date: Tue, 22 Oct 2024 09:29:48 +0200 Subject: [PATCH] fixes #471 by avoiding NPE when mappableMetadata is null --- .../java/org/dspace/discovery/SolrServiceFileInfoPlugin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceFileInfoPlugin.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceFileInfoPlugin.java index 590527025aaf..29c420e586fd 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceFileInfoPlugin.java +++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceFileInfoPlugin.java @@ -179,6 +179,7 @@ protected void addAndHandleException( } private void indexBitstreamsMetadatadas(SolrInputDocument document, Bitstream bitstream) { + if (mappableMetadata != null) { bitstream .getMetadata() .stream() @@ -190,6 +191,7 @@ private void indexBitstreamsMetadatadas(SolrInputDocument document, Bitstream bi .orElseGet(() -> new SolrFieldMetadataMapper(metadataField.toString(), bitstreamMetadataIndexAdder)) .map(document, metadata.getValue()); }); + } } public void setMappableMetadata(Map mappableMetadata) {