commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37704] - [validator] API Bug in org.apache.commons.validator.ValidatorResult
Date Wed, 11 Jan 2006 10:09:56 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37704>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37704


p.mouawad@ubik-ingenierie.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Additional Comments From p.mouawad@ubik-ingenierie.com  2006-01-11 11:09 -------
In fact I answered too fast, there is a little performance problem with what 
you proposed:
        Set set = validatorResults.getPropertyNames();
        Map propertyMap = new HashMap();

        for (Iterator iter = set.iterator(); iter.hasNext();) {
            String property= (String) iter.next();
            propertyMap.put(property, Boolean.TRUE);
            ValidatorResult result = validatorResults.getValidatorResult
(property);

            Map map = result.getActionMap();
            for (Iterator iterator = map.keySet().iterator(); iterator.hasNext
();) {
                String validatorName = (String)iterator.next();
                if (!result.isValid(validatorName)) {
                    propertyMap.put(property, Boolean.FALSE);
                    break;
                }
            }
        }

With my approach I don't need to get the value:
for (Iterator iterator = map.values().iterator(); iterator.hasNext();) {
ValidatorResult.ResultStatus element = (ValidatorResult.ResultStatus) 
iterator.next();
if (!element.isValid())

While with yours:
Map map = result.getActionMap();
for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
     String validatorName = (String)iterator.next();
     if (!result.isValid(validatorName)) =====>>> Here

What I need and I think would be useful for others is:
Get for each field of the form whether it is in error or not.

Thank you.
Philippe.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message