CSW GetRecords fails when requesting an outputSchema not supported by a metadata schema.#6941
Merged
Conversation
… a metadata schema. Fixes geonetwork#6940
juanluisrp
added a commit
to GeoCat/core-geonetwork
that referenced
this pull request
Jun 9, 2026
…eturned When harvesting via CSW GetRecords, the source returns pages of several records at once. Some CSW servers (GeoNetwork included) abort the whole GetRecords response when a single record of the page can not be serialized in the requested outputSchema, for instance an ISO 19110 feature catalogue requested with outputSchema=gmd, which has no gmd presentation. The harvester turned that page error into a fatal OperationAbortedEx and the whole harvest run stopped, leaving the catalogue partially harvested. Make the page fetch resilient: when the source returns an OWS exception for a page, split the page in half and retry each half. A single record that still fails is logged, skipped, and the harvest carries on with the rest. Each bad record costs O(log n) extra requests to isolate; in the sparse case this keeps the overhead low. In the worst case (every record in the page is bad) the split visits 2n-1 nodes, so the total is linear in the page size - bounded in practice because pages are small (typically 10-200 records), and still far fewer requests than fetching records one by one from the start. A SearchResults element is synthesized for the recovered page with consistent numberOfRecordsMatched, numberOfRecordsReturned (positions consumed, i.e. returned plus skipped) and nextRecord attributes, so the existing paging and end-of-set detection keep working unchanged. Only server-side OWS exceptions trigger this recovery. Connection and protocol errors, and all the existing handling of well-behaved and misbehaving servers (nextRecord based termination, old CSW namespace, GET/POST fallback), are left untouched. The recovery is on the harvester side, so it also handles non-GeoNetwork CSW servers that fail a page for any reason. The matching server-side behaviour, making a GeoNetwork source skip the records it can not present instead of failing the whole page, is tracked in geonetwork#6940 and proposed in geonetwork#6941; the two changes are complementary. Related to geonetwork#6940 Related to geonetwork#6941
fxprunayre
approved these changes
Jun 10, 2026
Member
There was a problem hiding this comment.
Tested with default samples and the option off and http://localhost:8080/geonetwork/srv/fre/csw?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetRecords&outputSchema=http://data.europa.eu/930/&elementSetName=full&resultType=results&maxRecords=30
<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.RuntimeException: org.fao.geonet.csw.common.exceptions.InvalidParameterValueEx: code=InvalidParameterValue, locator=OutputSchema, message=OutputSchema 'eu-geodcat-ap' not supported for metadata with '106' (dublin-core). Corresponding XSL transformation 'eu-geodcat-ap-full.xsl' (or 'eu-geodcat-ap.xsl') does not exist for this schema. The record will not be returned in response.</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6940
Add a new setting to customise the behaviour: