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

improve exception handling in xpath evaluation #2664

Merged
merged 3 commits into from
Oct 14, 2022

Conversation

flavorjones
Copy link
Member

@flavorjones flavorjones commented Oct 14, 2022

What problem is this PR intended to solve?

Avoid raising Ruby exceptions from within libxml2 error callbacks while evaluating xpath queries in xmlXPathEvalExpression. Instead, collect them in an array and raise an exception after xmlXPathEvalExpression returns.

Partly addresses #1610.

I've also cleaned up xml_xpath_context.c a bit while I was in there.

Have you included adequate test coverage?

Existing test coverage is appropriate.

Does this change affect the behavior of either the C or the Java implementations?

The only behavior change is for C to match JRuby's exception type when an xpath function can't be found. The test has been updated to remove the conditional on engine.

@flavorjones flavorjones marked this pull request as ready for review October 14, 2022 04:57
@flavorjones flavorjones merged commit 57d1a56 into main Oct 14, 2022
@flavorjones flavorjones deleted the flavorjones-xpath-eval-exception-handling branch October 14, 2022 13:35
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.

1 participant