Remove special chars from xml output by slawekjaranowski · Pull Request #28 · codehaus-plexus/plexus-xml
Looking at the code as a whole I absolutely do not understand why the framework allows to produce invalid (unescaped) XML. It simply does not make sense to me.
slawekjaranowski
changed the title
Testing special chars in xml output
Remove special chars from xml output
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, but I'd like @elharo to check as well.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with this API or code base, but at first glance it seems OK. I would add documentation in the appropriate spots indicating that C0 controls are omitted from output.
| text = escapeXml(text); | ||
|
|
||
| Matcher m = lowersText.matcher(text); | ||
| StringBuffer b = new StringBuffer(); |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringBuilder builder
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appendReplacement require StringBuffer, StringBuilder is supported from JDK 9
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurs to me that there are also some issues in this class with unpaired surrogates, but one piece of technical arcana at a time. :-)
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