-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
API / Batch editing / On preview mode, return exception #7794
base: main
Are you sure you want to change the base?
Conversation
When using preview mode, no report or exception are returned and it is hard to track what is wrong with XPath or XML snippet. Report exception directly.
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems invalid XPATH doesn't enter in the catch
block, for example using (missing "
in @xlink:href = https://metawal.wallonie.be
:
/mdb:MD_Metadata/mdb:identificationInfo/*/mri:descriptiveKeywords[*/mri:thesaurusName/*/cit:title/gcx:Anchor/@xlink:href = https://metawal.wallonie.be/thesaurus/infrasig"]/*/mri:keyword/gco:CharacterString[. = 'Reporting INSPIRE']
Indeed for the target node expression. It fails in https://github.com/geonetwork/core-geonetwork/blob/main/core/src/main/java/org/fao/geonet/kernel/EditLib.java#L945. I'm less confident changing that part where we decompose the xpath. For this PR, I propose to only concentrate on bad XML snippet and condition xpath. Maybe an option would be to try |
Sounds good @fxprunayre. I'll test the items you describe that are handled |
@fxprunayre For me it's not really working with invalid snippet. With a service metadata (iso19115.3-2008):
The preview doesn't fail and shows the following:
|
The snippet is not really invalid, because the value can also be text. So in your test, as it is not detected as XML, it is considered as text in https://github.com/geonetwork/core-geonetwork/blob/main/core/src/main/java/org/fao/geonet/kernel/AddElemValue.java#L44 and it is properly inserted in the XML document as text. |
When using preview mode, no report or exception are returned and it is hard to track what is wrong. Improved error reporting in preview mode for:
Report exception directly.
Further work would be required for xpath in target element (failing in https://github.com/geonetwork/core-geonetwork/blob/main/core/src/main/java/org/fao/geonet/kernel/EditLib.java#L945)
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 Service Public de Wallonie