commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Neidhart (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (COLLECTIONS-280) Add Predicate that failed PredicatedCollection.validate to IllegalArgumentException text
Date Thu, 28 Feb 2013 20:05:17 GMT

     [ https://issues.apache.org/jira/browse/COLLECTIONS-280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Thomas Neidhart resolved COLLECTIONS-280.
-----------------------------------------

    Resolution: Fixed
    
> Add Predicate that failed PredicatedCollection.validate to IllegalArgumentException text
> ----------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-280
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-280
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Collection
>    Affects Versions: 3.2
>         Environment: N/A
>            Reporter: Chris Lewis
>            Priority: Minor
>             Fix For: 4.0
>
>
> In a project I'm working on at the moment, I decorate some of my sets with multiple Predicates.
 In the event that validation fails, it would be nice to know which predicate caused the failure.
> I'd suggest changing the validate method in PredicatedCollection to:
>     protected void validate(Object object) {
>         if (predicate.evaluate(object) == false) {
>             throw new IllegalArgumentException("Cannot add Object '" + object + "' -
Predicate '" + predicate + "' rejected it");
>         }
>     }
> Then, the user can provide a toString method with relevant information about the Predicate
and why it might cause the validation to fail if they choose.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message