CommonsValidator doesn't take component converters into account!
----------------------------------------------------------------

                 Key: SHALE-412
                 URL: https://issues.apache.org/struts/browse/SHALE-412
             Project: Shale
          Issue Type: Bug
          Components: Validator
    Affects Versions: 1.0.4
         Environment: jsf1.1, shale.1.0.4, commons-validator.1.3.1
            Reporter: Hasan Turksoy


i'am trying to put a required validator for my date entering field.. My field 
has a f:convertDateTime to make conversion between String <-> java.util.Date. 
it's like;

<h:inputtext ...>
  <f:convertDateTime dateStyle="short" />
  <s:commonsvalidator type="required" arg="..." client="true" server="true" />
</h:inputtext> 

When i entered a valid value into my date field it throws a ConverterException 
as below;

"javax.faces.ConverterException: You have requested a conversion for type 
java.util.Date, but there is no by-type converter registered for this type."

the problem is; CommonsValidator always looks for by-type converters.. so, it 
needs a converter for the java.util.Date class.. But in JSF, one can add custom 
converter for each component separately... in this case, even if i had a 
converter for java.util.Date class, it won't be used by JSF RI! 
Because, user assigned a custom converter for that field!! JSF will use it 
instead of looking for a by-type converter... so, commons should use it too... 
otherwise, JSF RI and CommonsValidator behaving differently as my issue!

In conclusion; when we look at JSF RI code, we see that; it first looks for 
custom component converter, then, if can not find, searches for a by-type 
converter... CommonsValidator must work same i think... 

i have injected my solution into my CommonsValidator class and it works 
perfect... above suggestion should be implemented in original CommonsValidator 
releases as soon as possible i think...
 
i can provide code if required...

there is a conversation about this issue at :
http://www.nabble.com/CommonsValidator-doesn%27t-take-component-converters-into-account%21-tf3266040.html


-- 
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