Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://jira.opensymphony.com/secure/ViewIssue.jspa?key=WW-210 Here is an overview of the issue: --------------------------------------------------------------------- Key: WW-210 Summary: Enhancement to AbstractRangeValidator for nulls and no min or max Type: Improvement Status: Assigned Priority: Trivial Project: WebWork Components: Interceptors Versions: 2.0 Assignee: Patrick Lightbody Reporter: Cameron Braid Created: Mon, 9 Jun 2003 12:20 AM Updated: Mon, 9 Jun 2003 12:20 AM Description: AbstractRangeValidator ---------------------- Currently, if the value to be validated is null, a NPE is thrown, this can't be avoided even by inserting a required validator, as all validators are executed with the interceptor. - I suggest that if the value is null to skip the comparison step. - If a value is required, a required validator should be added, then this range interceptor can have an effect. Also, it would be nice to use the range validators to check either - just min - just max - both min and max Here is the code : public void validate(Action action) throws ValidationException { Comparable value = (Comparable) this.getFieldValue(getFieldName(), action); // if there is no value - don't do comparison // if a value is required, a required validator should be added to the field if (value == null) { return; } // only check for a minimum value if the min parameter is set if (getMinComparatorValue() != null && value.compareTo(getMinComparatorValue()) < 0) { addFieldError(getFieldName(), action); } // only check for a maximum value if the max parameter is set if (getMaxComparatorValue() != null && value.compareTo(getMaxComparatorValue()) > 0) { addFieldError(getFieldName(), action); } } IntRangeValidator ----------------- Change min and max defaults to be null rather that Integer(0) --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.opensymphony.com/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com. _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork