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

#57 Uncaught IllegalArgumentException due to malformed unicode entity ref #58

Closed
wants to merge 2 commits into from

Conversation

belingueres
Copy link
Contributor

  • Added a more readable error message by means of a
    XmlPullParserException.
  • Improved validation of the numeric character reference, according to
    XML 1.0 spec. (https://www.w3.org/TR/REC-xml/#NT-Char)

ref

- Added a more readable error message by means of a
XmlPullParserException.
- Improved validation of the numeric character reference, according to
XML 1.0 spec. (https://www.w3.org/TR/REC-xml/#NT-Char)
Copy link
Member

@hboutemy hboutemy left a comment

Choose a reason for hiding this comment

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

looks like a good catch, I'd like to integrate the change for version 3.2.0
can you have a look at 2 comments, please?

@@ -2664,7 +2664,8 @@ else if ( ch == '\t' || ch == '\n' || ch == '\r' )
entityRefName = null;
posStart = pos;
char ch = more();
StringBuilder sb = new StringBuilder();
StringBuilder sb16 = new StringBuilder();
StringBuilder sb10 = new StringBuilder();
Copy link
Member

Choose a reason for hiding this comment

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

instead of creating 2 separate string buffers, keeping sb and creating a "isHex" boolean would be a little bit more efficient and permit code sharing between the 2 cases since it's only a question of radix value, isn't it?

- Replaced two StringBuiders by one, added isHex boolean.
- Added tests for valid char references.
- Catched and fixed wrong parsing bug for decimal >= &#10000
(supplemental) char refs.
@hboutemy
Copy link
Member

squashed and merged 1dafbae
thank you for this great work

@hboutemy hboutemy closed this Mar 10, 2019
@hboutemy hboutemy self-assigned this Mar 10, 2019
@hboutemy hboutemy added this to the 3.2.0 milestone Mar 10, 2019
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.

2 participants