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

kie-issues#1807: Test Scenario version attribute is not correctly retrieved #6254

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

Conversation

yesamer
Copy link
Contributor

@yesamer yesamer commented Feb 13, 2025

Closes: apache/incubator-kie-issues#1807

The problem
The Test Scenario Engine needs to retrieve the scesim version from the xml root node to apply the correct migration strategy.
The current logic that retrieves that info, uses a regex search, that is too strict: regex patterns with this exact structure
<ScenarioSimulationModel version=\"x.x\" will be found. That means if any other attribute is present in the XML node (or just a single whitespace), the search will fail
eg. <ScenarioSimulationModel version=\"x.x\" <ScenarioSimulationModel namespace="..." version=\"x.x\"

The solution
In the same block of code, the DomParser of the xml file is already called. So, I just moved that in the first method line and took advantage of that to retrieve the version in a "safer" way.
This means, the regex search is no longer required, and the version can be safely retrieved disregarding its position in the node and avoiding collision with other possible attributes with the name.

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@yesamer yesamer requested a review from jomarko February 14, 2025 08:40
@yesamer
Copy link
Contributor Author

yesamer commented Feb 14, 2025

@jomarko Can you please review it?

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.

New SceSim Editor saved file can not be run as mvn clean verify
2 participants