commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodrigo Augusto Carlos Bispo <>
Subject CodeValidator - EAN13CheckDigit doesn't work
Date Sat, 08 Jun 2013 01:20:13 GMT
This link show how to create a validator to validate EAN-13 codes (numeric,
with a length of 13)

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);

public void shouldBeAnValidCodeEAN13() {


1. Note that I used EAN13CheckDigit.EAN13_CHECK_DIGIT and not

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?

Thank you

Bispo, Rodrigo

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message