You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/11/09 23:37:28 UTC
svn commit: r1713565 - in /commons/proper/validator/trunk/src:
changes/changes.xml
main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java
Author: sebb
Date: Mon Nov 9 22:37:28 2015
New Revision: 1713565
URL: http://svn.apache.org/viewvc?rev=1713565&view=rev
Log:
VALIDATOR-332 IIBANCheckDigit.calculate does not enforce initial checksum value
Modified:
commons/proper/validator/trunk/src/changes/changes.xml
commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java
Modified: commons/proper/validator/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/changes/changes.xml?rev=1713565&r1=1713564&r2=1713565&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/changes/changes.xml (original)
+++ commons/proper/validator/trunk/src/changes/changes.xml Mon Nov 9 22:37:28 2015
@@ -90,6 +90,10 @@ The dependencies for Validator have not
For the current list of dependencies, please see
http://commons.apache.org/validator/dependencies.html
">
+ <action issue="VALIDATOR-332" type="update" dev="sebb">
+ IIBANCheckDigit.calculate does not enforce initial checksum value
+ Checkdigit field is now unconditionally set to "00" to ensure correct generation
+ </action>
<action issue="VALIDATOR-353" type="update" dev="sebb">
UrlValidator does not allow for optional userinfo in the authority
</action>
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java?rev=1713565&r1=1713564&r2=1713565&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/IBANCheckDigit.java Mon Nov 9 22:37:28 2015
@@ -80,7 +80,7 @@ public final class IBANCheckDigit implem
* Calculate the <i>Check Digit</i> for an IBAN code.
* <p>
* <b>Note:</b> The check digit is the third and fourth
- * characters and and should contain value "<code>00</code>".
+ * characters and is set to the value "<code>00</code>".
*
* @param code The code to calculate the Check Digit for
* @return The calculated Check Digit as 2 numeric decimal characters, e.g. "42"
@@ -92,6 +92,7 @@ public final class IBANCheckDigit implem
throw new CheckDigitException("Invalid Code length=" +
(code == null ? 0 : code.length()));
}
+ code = code.substring(0, 2) + "00" + code.substring(4);
int modulusResult = calculateModulus(code);
int charValue = (98 - modulusResult);
String checkDigit = Integer.toString(charValue);