You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Vasily Ivanov (JIRA)" <ji...@apache.org> on 2008/04/23 04:03:28 UTC

[jira] Commented: (VALIDATOR-260) ValidatorAction should handle missing jsFunction nicer

    [ https://issues.apache.org/jira/browse/VALIDATOR-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591511#action_12591511 ] 

Vasily Ivanov commented on VALIDATOR-260:
-----------------------------------------

I looked at ValidatorAction class again and it looks like it throws ValidatorException when there are problems with Java parameters (classname, method, methodParams, etc.)... it should be consistent and throw the same error when processing javascript resources.

> ValidatorAction should handle missing jsFunction nicer
> ------------------------------------------------------
>
>                 Key: VALIDATOR-260
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-260
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Framework
>    Affects Versions: 1.3.1 Release
>         Environment: java 1.4.2_17
>            Reporter: Vasily Ivanov
>            Priority: Critical
>
> Example of custom validator:
>     <validator name="dateRange"
>       classname="SomeClass"
>       method="validateDateRange"
>       methodParams="java.lang.Object,
>                        org.apache.commons.validator.ValidatorAction,
>                        org.apache.commons.validator.Field,
>                        org.apache.struts.action.ActionMessages,
>                        org.apache.commons.validator.Validator,
>                        javax.servlet.http.HttpServletRequest"
>       depends="date" msg="errors.daterange"
>       jsFunction="com.company.path.to.jsfile.validateDateRange" />
> When jsFunction resource is missing (due to classpath or packaging issue, for example) ValidatorAction.readJavascriptFile(String) method just logs message "Unable to read javascript name com/company/path/to/jsfile/validateDateRange.js" on DEBUG(!) level, silently ignores it and process with other validators. Than all web pages are completely screwed up with errors complaining about missing javascript function but no reason why. It took me few hours to figure out what the problem is.
> Validator should at least log that message on warn/error level. I think it's even better to throw some kind of initializing exception. If jsFunction is specified you expect Validator to load it or fail if it can't find it not silently ignore it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.