commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <>
Subject [jira] [Resolved] (VALIDATOR-336) CUSIPCheckDigit thinks invalid CUSIP is valid
Date Thu, 01 Jan 2015 15:56:13 GMT


Benedikt Ritter resolved VALIDATOR-336.
    Resolution: Fixed

$ svn ci -m "VALIDATOR-336: CUSIPCheckDigit thinks invalid CUSIP is valid. Patch implemented
by Sebb. Thanks to Josh Meyer and Peter Lindberg who also contributed to the fix by providing
unit tests and proposing fixes."
Sending        RELEASE-NOTES.txt
Sending        src/changes/changes.xml
Sending        src/main/java/org/apache/commons/validator/routines/checkdigit/
Sending        src/test/java/org/apache/commons/validator/routines/checkdigit/
Transmitting file data ....
Committed revision 1648862.

Thanks to all for helping to get this fixed!

> CUSIPCheckDigit thinks invalid CUSIP is valid
> ---------------------------------------------
>                 Key: VALIDATOR-336
>                 URL:
>             Project: Commons Validator
>          Issue Type: Bug
>          Components: Routines
>    Affects Versions: 1.4.0 Release
>            Reporter: Josh Meyer
>            Assignee: Benedikt Ritter
>             Fix For: 1.4.1
>         Attachments:,,,
VALIDATOR-336.patch, cusip.patch
> When testing if a specific CUSIP is valid using org.apache.commons.validator.routines.checkdigit.CUSIPCheckDigit.CUSIP_CHECK_DIGIT.isValid,
a call to this returns true when it should return false. A specific example is with the following
invalid CUSIP: DUS0421CW.
> What seems to be happening is when toInt is called on W it turns it to an int value and
then sends it to weightedValue. This is fine for the first 8 characters of a CUSIP, but not
the check digit. The expected result should be to return false because the check digit is
a letter (on a CUSIP a check digit must be 0-9). 
> With the current implementation, I believe each CUSIP can have up to 4 valid check digits.
> A test is attached.

This message was sent by Atlassian JIRA

View raw message