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/22 07:13:21 UTC

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

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.


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

Posted by "Vasily Ivanov (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Vasily Ivanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/VALIDATOR-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12591559#action_12591559 ] 

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

Well, it looks like Validator tries to load javascript file even when neither jsFunction nor javascript is set... why?

16:00:23,640  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateRequiredif.js
16:00:23,640  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateValidwhen.js
16:00:23,671  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateLong.js
16:00:23,671  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateDouble.js
16:00:23,671  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateByteLocale.js
16:00:23,687  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateShortLocale.js
16:00:23,703  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateIntegerLocale.js
16:00:23,718  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateLongLocale.js
16:00:23,718  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateFloatLocale.js
16:00:23,734  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateDoubleLocale.js
16:00:23,750  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateLongRange.js
16:00:23,765  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateDoubleRange.js
16:00:23,781  main DEBUG [commons.validator.ValidatorAction:416]   Unable to read javascript name org/apache/commons/validator/javascript/validateUrl.js

> 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
>         Attachments: VALIDATOR-260.patch
>
>
> 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.


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

Posted by "Vasily Ivanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/VALIDATOR-260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Ivanov updated VALIDATOR-260:
------------------------------------

    Attachment: VALIDATOR-260.patch

Patch to throw ValidatorException when a javascript file does not exist or can't be read.
Unit test included.

> 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
>         Attachments: VALIDATOR-260.patch
>
>
> 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.