You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <fl...@gmail.com> on 2006/04/18 09:29:06 UTC

[lang] Entities question

Any ideas why there are unescape(String);String and unescape(Writer,
String) implementations in Entities - independently implemented? They
look like clones of each other - just one has nicer variable names.

Seems to me that:

a) One should call the other.
b) One could be deleted (given that Entities isn't public).

In the latter case, there are two users of the methods: unescapeHtml
calls the Writer,String and unescapeXml calls the String; so we would
delete one and make the two unescapeXxx methods call the same method.

Same applies for the escape() variants.

Hen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] Entities question

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Henri Yandell wrote:
> Any ideas why there are unescape(String);String and unescape(Writer,
> String) implementations in Entities - independently implemented? They
> look like clones of each other - just one has nicer variable names.

Typiclally you need a StringBuffer and a Writer variant of the same 
method otherwise you have to catch an exception and create an object.

Depends how much you are fussed about object creation or impossible 
exceptions.

In Joda-Time we often have both implementations even with code duplication.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org