Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix harvesting errors not always being reported #8647

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tobias-hotz
Copy link
Contributor

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

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

Funded by LGL BW

@josegar74 josegar74 added this to the 4.4.7 milestone Feb 14, 2025
Copy link
Member

@josegar74 josegar74 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tobias-hotz the code changes look good and now the errors are stored inthe harvester history table.

Without the pull request in the harvest history table, no errors are stored, while checking the log file there are errors:

    <logfile>harvester_csw_CSWErrorTest_20250214121701.log</logfile>
    <errors />

With the pull request:

   <logfile>harvester_csw_CSWErrorTest_20250214121952.log</logfile>
    <errors>
        <error>
            <description>java.lang.RuntimeException: java.lang.NullPointerException</description>
            <hint>Check with your administrator the error.</hint>
            ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants