[ http://issues.apache.org/struts/browse/SHALE-73?page=all ]
Craig McClanahan moved STR-2710 to SHALE-73: -------------------------------------------- Project: Shale (was: Struts Action 1) Key: SHALE-73 (was: STR-2710) Component: (was: Shale) Version: (was: Unknown) Assign To: (was: Struts Developer Mailing List) > range validators doesn't check dependecies > ------------------------------------------ > > Key: SHALE-73 > URL: http://issues.apache.org/struts/browse/SHALE-73 > Project: Shale > Type: Bug > Environment: Operating System: other > Platform: All > Reporter: Luca Conte > > I note that the class "public class CommonsValidator implements Validator, > Serializable" used by tag: <s:commonsValidator type="intRange" min="3" > max="5" > arg="Arg1" server="true" > client="false"/> FAILS if I put a string not stictly numerical like "foo" this > because the class does not check "validator depends" before validate the value > whith "intRange". > I solved by change this row into "public void validate(FacesContext context, > IComponent component, Object value)" method: > params[0] = convert(value, paramTypes[0], component); > with this code (I added the try-catch block): > try{ > params[0] = convert(value, paramTypes[0], component); > }catch(Exception e){ > Object errorValue = value; > if(component instanceof EditableValueHolder) > errorValue = ((EditableValueHolder)component) > .getSubmittedValue(); > throw new ValidatorException(new FacesMessage( > FacesMessage.SEVERITY_ERROR, > getErrorMessage(errorValue, context), null)); > } > As U can note the code inside the catch block is the same as the code used if > the value submitted fails the validation. > My solution should be rewroted better. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]