[ 
https://issues.apache.org/jira/browse/VALIDATOR-379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebb resolved VALIDATOR-379.
----------------------------
       Resolution: Fixed
    Fix Version/s: 1.5.2

Document the behaviour:

URL: http://svn.apache.org/viewvc?rev=1781789&view=rev
Log:
VALIDATOR-379 CodeValidator unconditionally trim()s the input string

Modified:
    commons/proper/validator/trunk/src/changes/changes.xml
    
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java


> CodeValidator unconditionally trim()s the input string
> ------------------------------------------------------
>
>                 Key: VALIDATOR-379
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-379
>             Project: Commons Validator
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 1.5.2
>
>
> The CodeValidator class unconditionally calls String#trim() on the input.
> This seems wrong.
> If the calling code uses the return value from validate to pass to other 
> methods that would be OK, but not all code will do so, especially since this 
> is not documented.
> Code that calls isValid() instead is likely to pass the untrimmed code to a 
> method which is not expecting the additional spaces.
> It's also possible (but rather unlikely) that there are formats which require 
> leading or trailing spaces.
> At the very least this behaviour needs to be documented.
> There probably ought to be a non-trimming version.
> Note that this affects the CreditCardValidator and the ISBNValidator.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to