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

Bug fix for building scenario with schematron. #135

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wustudent
Copy link

The code of v1.5.0 contains a bug which prevents building a scenario with schematron via the API:

In function Scenario.getSchematronValidations the function returns an empty list when there are no schematronValidations. But the return value Collections.emptyList() is an immutable list which can not perform add method. This getter will be called in ScenarioBuilder.buildSchematron with an add operation to add the build result, which leads to an UnsupportedOperationException

This pull request did the bug fix and add the test case for this case.

During the build, the schematron validation will be added when a schematron is provided in the schematron builder. To ensure the Transformation has been added to the list, the field schematronValidations should be set. Simply return an empty list will in the end ignore the provided schematron.
@wustudent
Copy link
Author

The behavior that simply return an empty list is however still wrong, this is because:
during the build stage of the scenario, when schematron is provided, schematron validation transformation should be added to the list of field schematronValidations. If we return an empty list but not assign it to the field, in the end all the schematrons will be ignored. Commit e5507b6 fixed this.

@wustudent wustudent marked this pull request as ready for review August 21, 2024 09:25
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.

1 participant