Author: sebb
Date: Wed Apr 13 21:50:14 2016
New Revision: 1739011
URL: http://svn.apache.org/viewvc?rev=1739011&view=rev
Log:
Revert last commit; note why it failed
Modified:
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CodeValidator.java
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=1739011&r1=1739010&r2=1739011&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
Wed Apr 13 21:50:14 2016
@@ -246,12 +246,6 @@ public final class CodeValidator impleme
return null;
}
- // check the length
- if ((minLength >= 0 && code.length() < minLength) ||
- (maxLength >= 0 && code.length() > maxLength)) {
- return null;
- }
-
// validate/reformat using regular expression
if (regexValidator != null) {
code = regexValidator.validate(code);
@@ -260,6 +254,12 @@ public final class CodeValidator impleme
}
}
+ // check the length (must be done after validate as that can change
the code)
+ if ((minLength >= 0 && code.length() < minLength) ||
+ (maxLength >= 0 && code.length() > maxLength)) {
+ return null;
+ }
+
// validate the check digit
if (checkdigit != null && !checkdigit.isValid(code)) {
return null;