You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Rodrigo Augusto Carlos Bispo (JIRA)" <ji...@apache.org> on 2013/06/03 06:10:20 UTC
[jira] [Created] (VALIDATOR-320) CodeValidator - EAN13CheckDigit
doesn't work
Rodrigo Augusto Carlos Bispo created VALIDATOR-320:
------------------------------------------------------
Summary: CodeValidator - EAN13CheckDigit doesn't work
Key: VALIDATOR-320
URL: https://issues.apache.org/jira/browse/VALIDATOR-320
Project: Commons Validator
Issue Type: Bug
Components: Routines
Affects Versions: 1.4.0 Release
Reporter: Rodrigo Augusto Carlos Bispo
Priority: Critical
Hi,
This link show how to create a validator to validate EAN-13 codes (numeric, with a length of 13)
http://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/package-summary.html#other.code
However I tested the method and always returns "false", like this...
public boolean isCodeEAN13Valid(String code) {
CodeValidator validator = new CodeValidator("^[0-9]*$", 13, EAN13CheckDigit.EAN13_CHECK_DIGIT);
return = validator.isValid(code);
}
@Test
public void shouldBeAnValidCodeEAN13() {
assertTrue(object.isCodeEAN13Valid("7501031311309"));
}
1. Note that I used EAN13CheckDigit.EAN13_CHECK_DIGIT and not EAN13CheckDigit.INSTANCE.
2. I did not found information about EAN13CheckDigit.INSTANCE. Is it from what release of commons.validator?
3. My constructor of CodeValidator and how it was applied and used in example is really right?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira