You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (Jira)" <ji...@apache.org> on 2020/07/26 23:09:00 UTC

[jira] [Resolved] (VALIDATOR-354) VerhoeffCheckDigit.isValid("0") == true but .calculate("") fails

     [ https://issues.apache.org/jira/browse/VALIDATOR-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved VALIDATOR-354.
----------------------------
    Resolution: Abandoned

> 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
(v8.3.4#803005)