Fixes XML Unescaping#362
Merged
Merged
Conversation
* Removes unescape from the XML class calls * fixes bug with unescape method * moves unescape logic into the XMLTokener class for more consistency
Owner
|
Sorry for the delay, back from eclipse, approved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
Fixes #361
What problem does this code solve?
Bug fix for XML Escaping that was included in a2d3b59 as part of a fix supporting unicode entities (i.e.

which maps to a new line character)The original fix was causing XML string to be unescaped twice which was also causing the bug as mentioned in #361.
Risks
Low/none. This is a bug fix to correct incorrect parsing of XML entities.
Changes to the API?
One new package level method was added to
XMLTokenerthat handles all valid XML entity unescaping.Will this require a new release?
Yes. The bug affects processing XML documents only, however, the bug prevents valid XML files from being read.
Should the documentation be updated?
No
Does it break the unit tests?
No. All unit tests should pass. New unit tests were added in order to test the changes and ensure that entities are only unencoded once. See stleary/JSON-Java-unit-test#79
Was any code refactored in this commit?
Yes. The actual implementation for the unescapeing was moved from the
XMLclass to theXMLTokenerclass.XMLTokenerwas already unescaping named entities (i.e.<to<and&to&) however it was not converting unicode entities back to their codepoints (i.e"to"or4to4). To compensate for that I originally created theXML.unescapemethod and incorrectly injected it into the XML processing.This PR corrects that by moving all the entity handling into the
XMLTokenerclass and removing theunescapeinjection that I placed into the processing last time.Review status
APPROVED Starting 3 day window for comments.