Sebb created VALIDATOR-354:
------------------------------
Summary: VerhoeffCheckDigit.isValid("0") == true but
.calculate("") fails
Key: VALIDATOR-354
URL: https://issues.apache.org/jira/browse/VALIDATOR-354
Project: Commons Validator
Issue Type: Bug
Reporter: Sebb
Priority: Minor
VerhoeffCheckDigit.isValid("0") is true but .calculate("") fails.
SInce isValid() includes the check digit that implies the empty string has a CD
of "0". However calculate throws CDE when presented with the empty string.
This is assymetric. I would expect to be able to redo the process to generate a
code which is valid.
Perhaps isValid() needs to return false if the original string is empty.
One could just add a check for includesCheckDigit && length <= 1 but I wonder
whether the algorithm could have a problem?
Needs further research.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)