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

INSPIRE Validator - exception handling improvements and Sonalint fixes #7519

Merged

Conversation

josegar74
Copy link
Member

This pull requests contains a refactor of the INSPIRE Validator backend code to improve the exception handling.

Previously some exceptions were not reported properly to the user. For example, if the upload of a file to validate returned an error, due to the validator not working properly (for example, returning an error 503), the user got an unclear error message:

inspirevalidator-error

Additionally, the pull request contains Sonarlint fixes.

Checklist

  • I have read the [contribution guidelines](https://github.com/geonetwork/core-geonetwork/blob/main/CONTRIBUTING.md
  • 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 mannual
  • 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

Copy link
Contributor

@juanluisrp juanluisrp left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment on lines +266 to +267
Log.error(Log.SERVICE,
"INSPIRE service HTTP response: " + response.getStatusCode().value() + " for " + TESTOBJECTS_URL);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't possible to log also the response body, maybe with a lower level log?

} catch (Exception e) {
Log.error(Log.SERVICE, "Error calling INSPIRE service: " + endPoint, e);
return null;
throw new InspireValidatorException(String.format("Error calling INSPIRE service: %s, %s", endPoint, e.getMessage()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd pass the full exception e to new InspireValidatorException() constructor to allow the logger to print Caused by: ... and get the full stacktrace.

@juanluisrp juanluisrp merged commit 7aebde0 into geonetwork:main Dec 7, 2023
6 checks passed
juanluisrp pushed a commit that referenced this pull request Dec 7, 2023
Refactor of the INSPIRE Validator backend code to improve the exception handling.

Previously some exceptions were not reported properly to the user. For example, if the upload of a file to validate returned an error, due to the validator not working properly (for example, returning an error 503), the user got an unclear error message.
Additionally this commit contains some fixes to Sonarlint warnings
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.

None yet

3 participants