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

Gary D. Gregory commented on LANG-1326:
---------------------------------------

IMO this ticket is wrong and the change for LANG-1271 was not thought all the 
way through in the context of our existing APIs.

Let's start with the primitive operations {{isBlank(CharSequence)}} and  
{{isEmpty(CharSequence)}} and note that these APIs consider null to be the same 
as an empty string. IOW, a null sequence of character is the same as an empty 
array (size 0).

This lets me validate input and make sure input exists for my app. As currently 
defined, the methods above will do the job and return false if null or "" are 
given as input.

So far so good.

Now, let's consider isAnyEmpty(CharSequence...):

The answer to {{isAnyEmpty(CharSequence1, CharSequence1)}}

better be the same as:

{{isEmpty(CharSequence1) || isEmpty(CharSequence2)}}.

We're still good.

The answer to {{isAnyEmpty(null)}} is still {{true}}, good. I can still tell 
the user/provider that he needs to provide input or my app will break.

But now {{isAnyEmpty((String[]) null)}} return false? Whaaaaat? My app's error 
checking saying null input is not empty? Someone my app can proceed with null 
input?

That's wrong and this ticket is wrong for the same reason IMO.

 In fact I would hope to revert LANG-1271. 

 

> StringUtils#isAllEmpty and #isAllBlank should return false for an empty array
> -----------------------------------------------------------------------------
>
>                 Key: LANG-1326
>                 URL: https://issues.apache.org/jira/browse/LANG-1326
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.6
>            Reporter: Arshad Basha
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> If the description of https://issues.apache.org/jira/browse/LANG-1271 is what 
> is the agreed behavior, then I believe isAllEmpty and isAllBlank method 
> should be updated as well. Please let me know if i'm missing something on 
> this.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to