Fix harvesting errors not always being reported #8647
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.
This Pull Request fixes an issue with the way how harvesters report their errors.
Currently, there are two lists that may contain error, one in AbstractHarvester and one in many harvester classes. The intent is to merge these two lists in AbstractHarvester via the
getErrors()
method.This, however, does not work, as getErrors always returns the List that is present in AbstractHarvester. There seems to be an inheritance issue here: The subclasses of AbstractHarvester do not implement getErrors themself, but the classes that are called by the subclasses.
Let's take the CSW Harvester as an example: The subclass of AbstractHarvester CswHarvester does not override getErrors, but it contructs an instace of Harvester, which is an instace of IHarvester. IHarvester and AbstractHarvester are two distinct classes, and as the CSWHarvester does not forward the errors of the newly created Harvester, these errors are just lost.
This means that many errors just get swallowed, and in some cases a harvesting run seems successful, but upon closer inspection (log or harvesting result), there was actually an error!
The fix is simple: just give the actual IHarvester implementations a reference to the same error list that AbstractHarvester uses.
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentationFunded by LGL BW