commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException
Date Sat, 13 Sep 2008 12:48:47 GMT

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

James Carman commented on LANG-458:
-----------------------------------

We couldn't use that particular API since it would break existing applications (you can't
have a method with the same name and parameter types and a different return type).  Perhaps
adding a new class called Validations (Validate could be based on it)?
\\
\\
{code}
if(!Valdations.isEmpty(list)) { continue; }
{code}

> Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException
> ---------------------------------------------------------------------------------------------
>
>                 Key: LANG-458
>                 URL: https://issues.apache.org/jira/browse/LANG-458
>             Project: Commons Lang
>          Issue Type: Improvement
>         Environment: software
>            Reporter: Viraj Turakhia
>            Priority: Minor
>
> I am using Validate.java since long and find it difficult to use when I just want to
validate collections or string.
> With current interface, I go like this:
> while(cnt < list.size()) {
>     List list1 = list.get(cnt);
>     try {
>         Validate.notEmpty(list1);
>     } catch(IllegalArgumentException e) {
>         continue;
>     }
> }
> much better approach is:
> while(cnt < list.size()) {
>     List list1 = list.get(cnt);
>     try {
>     if(! Validate.notEmpty(list1)) {
>         continue;
>     }
> }
> If you all agree with this change, I am willing to submit a patch for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message