[ 
https://issues.apache.org/jira/browse/TEXT-88?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16051802#comment-16051802
 ] 

Gilles commented on TEXT-88:
----------------------------

Referring the description of this issue, I think that
{code}
WordUtils.capitalizeFully("i am fine", new char[]{})
{code}
could output "I AM FINE" (if empty would be considered the same as not 
provided).

bq. your logic ... throw NPE?

Yes, whenever not being able to infer the meaning of {{null}} cannot produce an 
unequivocal result.
In the above, it should rather be {{IllegalArgumentException}}...

Syntactic sugar is another issue (e.g. we could imagine a "sloppy" version of 
{{StringUtils}} that prominently _transforms_ any {{null}} to something that 
will not trigger an exception).

bq. StringUtils.equals("abc", null)  = false

This one is fine though: the result is always right when one argument is 
{{null}} and the other is not.
Much less obvious is {{StringUtils.equals(null, null)}}.
But the current logic crumbles when {{null}} is considered equals to the empty 
string:
{code}
StringUtils.equals(null, null); // true (but most probably a programming error)
StringUtils.equals("", null); // ?
{code}


> WordUtils.capitalizeFully behaves in a counterintuitive manner with empty 
> delimiter array.
> ------------------------------------------------------------------------------------------
>
>                 Key: TEXT-88
>                 URL: https://issues.apache.org/jira/browse/TEXT-88
>             Project: Commons Text
>          Issue Type: Bug
>            Reporter: Rob Tompkins
>
> As discussed in TEXT-85, it seems that 
> {code:java}
> WordUtils.capitalizeFully("i am fine", new char[]{}) // --> i am fine
> {code}
> Both Sebb and Arun think that this is odd and that the letter "i" should have 
> been capitalized resulting in the output {{I am fine}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to