commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Resolved] (VALIDATOR-379) CodeValidator unconditionally trim()s the input string
Date Sun, 05 Feb 2017 18:47:41 GMT


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

Document the behaviour:

VALIDATOR-379 CodeValidator unconditionally trim()s the input string


> CodeValidator unconditionally trim()s the input string
> ------------------------------------------------------
>                 Key: VALIDATOR-379
>                 URL:
>             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

View raw message