Hi,

 

Is anybody actually using the DefaultValidator? I noticed that some bugs I pointed out in it a while back were never fixed. Was this just overlooked or was I incorrect? If it was just an oversight I’d be happy to patch it myself, I have a version with fixes. As it is in cvs I just don’t see how it could possibly work. Here are the problems I see:

 

1)       The following block of code runs any time the “validation-error” element is present, *even if there were no validation errors*

2)       The return statement is *inside* the params loop, meaning a) it will only return if params=true, and b) it will return after the first iteration of the loop if params=true

 

<snippet>

 

                        if (conf.getChild("validation-error", false) != null) {

                                    Configuration validationErrorConfig = conf

                                                            .getChild("validation-error");

                                    Command redirect = req.createResponse().createCommand(

                                                            validationErrorConfig.getAttribute("model"));

                                    /* Catch dumb mistake... :-) */

                                    if (validationErrorConfig.getAttribute("model").equals(

                                                            req.getModel())) {

                                                throw new ConfigurationException("Cannot specify model '"

                                                                        + validationErrorConfig.getAttribute("moodel")

                                                                        + "' to have itself as the validation-error model!");

                                    }

                                    if (validationErrorConfig.getAttributeAsBoolean("params", true)) {

                                                String >

                                                for (Iterator i = req.getParameters().keySet().iterator(); i

                                                                        .hasNext();) {

                                                            i.next();

                                                            redirect.setParameter(oneParamName, req

                                                                                    .getParameter(oneParamName));

                                                return redirect;

                                                }

                                    }

                        }

</snippet>

 

 

Reply via email to