protected Resolution doCustomValidation(final ExecutionContext ctx, boolean doValidate) throws Exception { final ValidationErrors errors = ctx.getActionBeanContext().getValidationErrors(); final ActionBean bean = ctx.getActionBean(); Configuration config = StripesFilter.getConfiguration();      if (doValidate) {  ctx.setLifecycleStage(LifecycleStage.CustomValidation); ctx.setInterceptors(config.getInterceptors(LifecycleStage.CustomValidation));  return ctx.wrap( new Interceptor() { public Resolution intercept(ExecutionContext context) throws Exception {   if ( (alwaysInvokeValidate || errors.isEmpty()) && bean instanceof Validatable) { ((Validatable) bean).validate(errors); }   Method[] validations = findCustomValidationMethods(bean.getClass()); for (Method validation : validations) { ValidationMethod ann = validation.getAnnotation(ValidationMethod.class);  boolean run = (ann.when() == ValidationState.ALWAYS) || (ann.when() == ValidationState.DEFAULT && alwaysInvokeValidate) || errors.isEmpty();  if (run && applies(ann, ctx.getActionBeanContext().getEventName())) { Class[] args = validation.getParameterTypes(); if (args.length == 1 && args[0].equals(ValidationErrors.class)) { validation.invoke(bean, errors); } else { validation.invoke(bean); } } }  return null; } }); } else { return null; }
protected Resolution doCustomValidation(ExecutionContext ctx) throws Exception { return DispatcherHelper.doCustomValidation(ctx, alwaysInvokeValidate);
    protected Resolution doCustomValidation(final ExecutionContext ctx, boolean doValidate) throws Exception {        final ValidationErrors errors = ctx.getActionBeanContext().getValidationErrors();        final ActionBean bean = ctx.getActionBean();        Configuration config = StripesFilter.getConfiguration();        // Run the bean's validate() method if the following conditions are met:        //   1. This event is not marked to bypass validation (doValidate == true)        //   2. The bean is an instance of Validatable        //   3. We have no errors so far OR alwaysInvokeValidate is true        if (doValidate) {            ctx.setLifecycleStage(LifecycleStage.CustomValidation);            ctx.setInterceptors(config.getInterceptors(LifecycleStage.CustomValidation));            return ctx.wrap( new Interceptor() {                public Resolution intercept(ExecutionContext context) throws Exception {                    // Run the legacy style validate() method                    if ( (alwaysInvokeValidate || errors.isEmpty()) && bean instanceof Validatable) {                        ((Validatable) bean).validate(errors);                    }                    // Run any of the new style validation methods                    Method[] validations = findCustomValidationMethods(bean.getClass());                    for (Method validation : validations) {                        ValidationMethod ann = validation.getAnnotation(ValidationMethod.class);                        boolean run = (ann.when() == ValidationState.ALWAYS)                                   || (ann.when() == ValidationState.DEFAULT && alwaysInvokeValidate)                                   || errors.isEmpty();                        if (run && applies(ann, ctx.getActionBeanContext().getEventName())) {                            Class[] args = validation.getParameterTypes();                            if (args.length == 1 && args[0].equals(ValidationErrors.class)) {                                validation.invoke(bean, errors);                            }                            else {                                validation.invoke(bean);                            }                        }                    }                    return null;                }            });        }        else {            return null;        }    }