You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2014/11/09 12:38:33 UTC

[jira] [Commented] (VALIDATOR-336) CUSIPCheckDigit Thinks Invalid CUSIP is Valid

    [ https://issues.apache.org/jira/browse/VALIDATOR-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14203888#comment-14203888 ] 

Benedikt Ritter commented on VALIDATOR-336:
-------------------------------------------

After applying the patch I get:

{code}
Failed tests:
  org.apache.commons.validator.ISBNValidatorTest#testIsValid AssertionFailedError
  org.apache.commons.validator.routines.checkdigit.CUSIPCheckDigitTest#testCalculateInvalid AssertionFailedError
  org.apache.commons.validator.routines.checkdigit.ISBN10CheckDigitTest#testIsValidTrue AssertionFailedError
  org.apache.commons.validator.routines.checkdigit.ISBNCheckDigitTest#testIsValidTrue AssertionFailedError
  org.apache.commons.validator.routines.ISBNValidatorTest#testIsValidISBN10 AssertionFailedError
  org.apache.commons.validator.routines.ISBNValidatorTest#testValidateISBN10 ComparisonFailure
  org.apache.commons.validator.routines.ISBNValidatorTest#testValidateISBN10Convert ComparisonFailure
{code}

Can you check?

> CUSIPCheckDigit Thinks Invalid CUSIP is Valid
> ---------------------------------------------
>
>                 Key: VALIDATOR-336
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-336
>             Project: Commons Validator
>          Issue Type: Bug
>            Reporter: Josh Meyer
>         Attachments: CusipValidatorTest.java, VALIDATOR-336.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
(v6.3.4#6332)