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

Standard / ISO19115-3 / Batch edit may trigger error on creation date #7712

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

fxprunayre
Copy link
Member

This should not happen when records are created using the editor but importing a record with no creation date and then directly applying a batch editing (which does not update dates) will trigger the following error:

"; SystemID: file://web/src/main/webapp/WEB-INF/data/config/schema_plugins/iso19115-3.2018/update-fixed-info.xsl; Line#: 134; 
An empty sequence is not allowed as the first argument of gn-fn-iso19115-3.2018:write-date-or-dateTime()

Avoiding that case.

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 Ifremer

This should not happen when records are created using the editor but importing a record with no creation date and then directly applying a batch editing (which does not update dates) will trigger the following error: 

```
"; SystemID: file://web/src/main/webapp/WEB-INF/data/config/schema_plugins/iso19115-3.2018/update-fixed-info.xsl; Line#: 134; 
An empty sequence is not allowed as the first argument of gn-fn-iso19115-3.2018:write-date-or-dateTime()
```

Avoiding that case.
@fxprunayre fxprunayre added this to the 4.4.3 milestone Feb 7, 2024
Copy link

sonarcloud bot commented Feb 7, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

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.

The code change make sense to me, but the test case is not really working for me. Maybe not doing the steps properly:

  1. Created an ISO19115-3 metadata and exported to XML
  2. Edited locally and removed the creation date and assigned a new UUID
  3. Import the metadata --> the new metadata gets a creation date
  4. Batch editing adding a keyword works as expected.

I did these steps without the changes, to try to reproduce the issue.

@fxprunayre
Copy link
Member Author

The code change make sense to me, but the test case is not really working for me. Maybe not doing the steps properly:

  1. Created an ISO19115-3 metadata and exported to XML
  2. Edited locally and removed the creation date and assigned a new UUID
  3. Import the metadata --> the new metadata gets a creation date
  4. Batch editing adding a keyword works as expected.

I did these steps without the changes, to try to reproduce the issue.

can you try batch editing with this?

{"field":"XPath_1","insertMode":"gn_delete","xpath":".//mri:topicCategory","value":"","isXpath":true,"condition":""}

image

The error is not happening if the batch editing does nothing ie. Records unchanged

@josegar74
Copy link
Member

@fxprunayre with the PR the error is triggered, I guess that is not what is expected, correct?

; SystemID: file:/private/tmp/core-geonetwork-main/web/src/main/webapp/WEB-INF/data/config/schema_plugins/iso19115-3.2018/update-fixed-info.xsl; Line#: 135; Column#: -1
net.sf.saxon.trans.XPathException: An empty sequence is not allowed as the first argument of gn-fn-iso19115-3.2018:write-date-or-dateTime()
	at net.sf.saxon.expr.Expression.typeError(Expression.java:981)
	at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:277)

Attached the metadata used.

1dcdfd6c-a436-4bac-8683-ab2f05a34e21.txt

@fxprunayre
Copy link
Member Author

@fxprunayre with the PR the error is triggered, I guess that is not what is expected, correct?

This is related to you record not having a revision date (creation date error was fixed) - which should not happen usually. I added a check for this case too.

Copy link

sonarcloud bot commented Mar 12, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@fxprunayre fxprunayre merged commit 1be84ac into main Mar 13, 2024
9 checks passed
@fxprunayre fxprunayre modified the milestones: 4.4.3, 4.4.4 Mar 13, 2024
@fxprunayre fxprunayre deleted the 44-batcheditcreationdate branch March 14, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants