From 116c6a710cae9f98013ce971180723410dceb16d Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Wed, 18 Dec 2024 11:13:55 +0100 Subject: [PATCH] fix : csw server not ignoring failures --- .../services/getrecords/SearchController.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java b/csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java index 4972ac046e..8ea31d0611 100644 --- a/csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java +++ b/csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java @@ -53,10 +53,7 @@ import org.fao.geonet.kernel.search.EsSearchManager; import org.fao.geonet.utils.Log; import org.fao.geonet.utils.Xml; -import org.jdom.Attribute; -import org.jdom.Content; -import org.jdom.Element; -import org.jdom.Namespace; +import org.jdom.*; import org.springframework.beans.factory.annotation.Autowired; import java.nio.file.Files; @@ -510,16 +507,20 @@ public Element search(ServiceContext context, int startPos, int maxRecords, AbstractMetadata metadata = metadataUtils.findOne(mdId); String displayLanguage = context.getLanguage(); + try { // The query to retrieve GetRecords, filters by portal. No need to re-check again when retrieving each metadata. - Element resultMD = retrieveMetadata(context, metadata.getId() + "", - setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage, false); + Element resultMD = retrieveMetadata(context, metadata.getId() + "", + setName, outSchema, elemNames, typeName, resultType, strategy, displayLanguage, false); - if (resultMD != null) { - if (resultType == ResultType.RESULTS) { - results.addContent(resultMD); - } + if (resultMD != null) { + if (resultType == ResultType.RESULTS) { + results.addContent(resultMD); + } - counter++; + counter++; + } + } catch (InvalidParameterValueEx e) { + results.addContent(new Comment(e.getMessage())); } }