Commons Validator
  1. Commons Validator
  2. VALIDATOR-331

IBANCheckDigitTest.createInvalidCodes(String[] codes) uses wrong values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0 Release
    • Fix Version/s: 1.4.1 Release
    • Component/s: None
    • Labels:
      None

      Description

      The method IBANCheckDigitTest.createInvalidCodes(String[] codes) tries to
      create bad check-digit IBANs from valid ones by replacing the check digit pair with something different.

      However the code to do this is faulty, as it assumes check digits are in the range 00-95. This is wrong, as check digits are actually in the range 02-98.

        Activity

        Hide
        Sebb added a comment -

        This was spotted when checking VALIDATOR-330.
        When IE98xxxx was added to the list of valid codes, this caused some invalid checkdigit tests to fail.
        The test case code generated the string IE01xxxx which has the same result mod 97, so is equally valid currently (the code does not reject impossible check digits).

        Show
        Sebb added a comment - This was spotted when checking VALIDATOR-330 . When IE98xxxx was added to the list of valid codes, this caused some invalid checkdigit tests to fail. The test case code generated the string IE01xxxx which has the same result mod 97, so is equally valid currently (the code does not reject impossible check digits).
        Hide
        Sebb added a comment -

        URL: http://svn.apache.org/r1562475
        Log:
        VALIDATOR-331 IBANCheckDigitTest.createInvalidCodes(String[] codes) uses wrong values

        Modified:
        commons/proper/validator/trunk/src/changes/changes.xml
        commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java

        Show
        Sebb added a comment - URL: http://svn.apache.org/r1562475 Log: VALIDATOR-331 IBANCheckDigitTest.createInvalidCodes(String[] codes) uses wrong values Modified: commons/proper/validator/trunk/src/changes/changes.xml commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigitTest.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Sebb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development