[jdom-interest] Patch - surrogate pair output support

Jason Hunter jhunter at servlets.com
Fri Dec 7 22:13:01 PST 2007


Hi Dave,

This looks like really good code.  Thanks for the submission!

I'm worried about these two signature changes:

- public String escapeAttributeEntities(String str) {
+ public String escapeAttributeEntities(String str) throws IOException {

- public String escapeElementEntities(String str) {
+ public String escapeElementEntities(String str) throws IOException {

They're public methods.  If we add a new checked exception, it breaks 
drop-in backward compatibility.  Perhaps the IOException should be made 
into a runtime exception.  The internal calls to the methods in 
XMLOutputter could catch the runtime exception and convert it to an 
IOException so normal callers would see an IOException, but any direct 
callers we've accumulated over the years won't break because they'll see 
the runtime.  Thoughts?

Also, do you think you could write a test case for this?  Something so 
if we ever break it later we'll know.  I'm asking you since you're more 
expert than I am on this topic.

Lastly, is there a reason you didn't break out the repeated code inside 
the shouldEscape() block into its own method?

Thanks again,
-jh-

Dave Byrne wrote:
> Attached is a patch to provide support for outputting documents with 
> XMLOutputter that contain non-BMP utf-16 characters as surrogate pairs.
> 
> Patch is against cvs HEAD.



More information about the jdom-interest mailing list