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.

Reply via email to