-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fix RuntimeError in REXML::Parsers::BaseParser
for valid feeds
#199
Fix RuntimeError in REXML::Parsers::BaseParser
for valid feeds
#199
Conversation
* Change `#entity` to not match against default entities Close ruby#198
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.
Could you add a test for this case?
@naitoh Could you review this? |
* Explicitly set `value` to `nil` * Remove unnecessary conditional Co-Authored-By: Sutou Kouhei <kou@clear-code.com>
Adds tests for SAX parser, Pull parser and Stream parser when the source contains only default entities
I've added some tests in 6555c27, let me know what you think. |
before (This PR) def entity( reference, entities )
value = nil
value = entities[ reference ] if entities
if value
record_entity_expansion
return unnormalize( value, entities )
end
nil
end
after def entity( reference, entities )
return unless entities
value = entities[ reference ]
return if value.nil?
record_entity_expansion
unnormalize( value, entities )
end Thanks. |
* Early return if there is no `entities` * Early return if there is no match for `reference` in `entities` Co-Authored-By: NAITOH Jun <naitoh@gmail.com>
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.
Additional review.
* Remove unnecessary `StringIO.new` Co-Authored-By: NAITOH Jun <naitoh@gmail.com>
I have checked this PR. |
Thanks. |
#entity
to not match against default entitiesAfter this change, the following example will not raise a RuntimeError:
Default entities now gets substituted by this block instead
rexml/lib/rexml/parsers/baseparser.rb
Lines 560 to 563 in e14847c
Close #198