commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jopaki <jop...@gmail.com>
Subject Possible bug? [validator]
Date Mon, 20 Jun 2005 16:00:32 GMT
Hi all,

I downloaded commons-validator v1.1.4 and I think I ran into a bug in
the method:

    ValidatorResults validate(Map params, Map actions)
        throws ValidatorException 

specifically the block:
********************************

        for (int fieldNumber = 0; fieldNumber <
numberOfFieldsToValidate; fieldNumber++) {
            
            ValidatorResults results = new ValidatorResults();
            // this is the "fix the bug" location

            Iterator dependencies = this.dependencyList.iterator();
            while (dependencies.hasNext()) {
                String depend = (String) dependencies.next();

                ValidatorAction action = (ValidatorAction) actions.get(depend);
                if (action == null) {
                    this.handleMissingAction(depend);
                }

          	//ValidatorResults results = new ValidatorResults();
                // this is the "original" location that is "buggy"

                boolean good =
                    validateForRule(action, results, actions, params,
fieldNumber);

                allResults.merge(results);

                if (!good) {
                    return allResults;
                }
            }
        }
********************************

I moved the line that instantiates the local var: 'results'
(ValidatorResults ) OUTSIDE of the while loop so the validations
performed based on the dependencies (resolved to actions) are not lost
between passes of the while loop.

Please advise.

Thanks!

Jon Kirton
jopaki@yahoo.com
-- 
-jpk-

---------------------------------------------------------------------
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