Author: sebb Date: Sun Feb 5 18:46:45 2017 New Revision: 1781789 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 Modified: commons/proper/validator/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/changes/changes.xml?rev=1781789&r1=1781788&r2=1781789&view=diff ============================================================================== --- commons/proper/validator/trunk/src/changes/changes.xml (original) +++ commons/proper/validator/trunk/src/changes/changes.xml Sun Feb 5 18:46:45 2017 @@ -90,6 +90,9 @@ The dependencies for Validator have not For the current list of dependencies, please see http://commons.apache.org/validator/dependencies.html "> + <action issue="VALIDATOR-379" type="fix" dev="sebb"> + CodeValidator unconditionally trim()s the input string - document the behaviour + </action> <action issue="VALIDATOR-387" type="fix" dev="sebb" due-to=" Shumpei Akai"</>> Userinfo without colon should be valid in UrlValidator </action> Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java?rev=1781789&r1=1781788&r2=1781789&view=diff ============================================================================== --- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java (original) +++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java Sun Feb 5 18:46:45 2017 @@ -218,6 +218,13 @@ public final class CodeValidator impleme /** * Validate the code returning either <code>true</code> * or <code>false</code>. + * <p> + * This calls {@link #validate(String)} and returns false + * if the return value is null, true otherwise. + * <p> + * Note that {@link #validate(String)} trims the input + * and if there is a {@link RegexValidator} it may also + * change the input as part of the validation. * * @param input The code to validate * @return <code>true</code> if valid, otherwise @@ -230,6 +237,10 @@ public final class CodeValidator impleme /** * Validate the code returning either the valid code or * <code>null</code> if invalid. + * <p> + * Note that this method trims the input + * and if there is a {@link RegexValidator} it may also + * change the input as part of the validation. * * @param input The code to validate * @return The code if valid, otherwise <code>null</code>