commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jopaki <>
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);

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

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

                boolean good =
                    validateForRule(action, results, actions, params,


                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.


Jon Kirton

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message