diff --git a/src/main/java/org/apache/commons/validator/routines/VATINValidator.java b/src/main/java/org/apache/commons/validator/routines/VATINValidator.java index 4c3551c6a..bb373c543 100644 --- a/src/main/java/org/apache/commons/validator/routines/VATINValidator.java +++ b/src/main/java/org/apache/commons/validator/routines/VATINValidator.java @@ -170,7 +170,7 @@ public RegexValidator getRegexValidator() { new Validator("RO", VATidROCheckDigit.getInstance(), 12, "[1-9](\\d)?(\\d)?(\\d)?(\\d)?(\\d)?(\\d)?(\\d)?(\\d)?\\d"), new Validator("SE", VATidSECheckDigit.getInstance(), 14, "\\d{10}01"), new Validator("SI", VATidSICheckDigit.getInstance(), 10, "[1-9]\\d{7}"), - // ne of 2, 3, 4, 7, 8, 9 + // 2nd digit: one of 2, 3, 4, 7, 8, 9 new Validator("SK", VATidSKCheckDigit.getInstance(), 12, "[1-9]\\d[2-4,7-9]\\d{7}"), new Validator("XI", VATidGBCheckDigit.getInstance(), 14, "(\\d{3})?\\d{9}"), }; diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus11TenCheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus11TenCheckDigit.java index 82eeb241d..4754c93be 100644 --- a/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus11TenCheckDigit.java +++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus11TenCheckDigit.java @@ -84,7 +84,6 @@ public String calculate(final String code) throws CheckDigitException { if (GenericTypeValidator.formatLong(code) == 0) { throw new CheckDigitException(CheckDigitException.ZERO_SUM); } - return toCheckDigit(calculateModulus(code, false)); } diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus97CheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus97CheckDigit.java index 00c52a239..13cfff820 100644 --- a/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus97CheckDigit.java +++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/Modulus97CheckDigit.java @@ -16,8 +16,6 @@ */ package org.apache.commons.validator.routines.checkdigit; -import java.io.Serializable; - import org.apache.commons.validator.GenericTypeValidator; import org.apache.commons.validator.GenericValidator; @@ -34,9 +32,7 @@ * * @since 1.10.0 */ -public class Modulus97CheckDigit extends AbstractCheckDigit implements Serializable { - - private static final long serialVersionUID = -5746038014913492394L; +public class Modulus97CheckDigit extends AbstractCheckDigit { /** Singleton Check Digit instance */ private static final Modulus97CheckDigit INSTANCE = new Modulus97CheckDigit(); @@ -144,7 +140,6 @@ public boolean isValid(final String code) { if (icheck == null) { return false; } - try { long mr = calculateModulus(code, false); int modulusResult = (int) (mr % modulus); diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/TidDECheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/TidDECheckDigit.java index 2f0f9a3b0..6ab45c44a 100644 --- a/src/main/java/org/apache/commons/validator/routines/checkdigit/TidDECheckDigit.java +++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/TidDECheckDigit.java @@ -30,19 +30,6 @@ * * @since 1.10.0 */ -/* (de) - * deutsche persönliche Steuer-Identifikationsnummer. - * - * Algorithmus siehe bgbl193s0736, Bundesgesetztblatt, Jahrgang 1993, Teil I - * Anlage 3 (zu §9) - * - * hybrides MOD 11,10 Verfahren - * Aufbau: nnnnnnnnnnp. - * - * Quelle: Bayerisches Landesamt für Steuern: elster.de - * Beispiel: 02476291358 : TestID da führende 0 - * - */ public final class TidDECheckDigit extends Modulus11TenCheckDigit { private static final long serialVersionUID = 4222306963463322195L; diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBECheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBECheckDigit.java index c3289128f..3043da037 100644 --- a/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBECheckDigit.java +++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBECheckDigit.java @@ -37,8 +37,6 @@ */ public final class VATidBECheckDigit extends Modulus97CheckDigit { - private static final long serialVersionUID = 4622288405648808179L; - /** Singleton Check Digit instance */ private static final VATidBECheckDigit INSTANCE = new VATidBECheckDigit(); @@ -59,7 +57,9 @@ private VATidBECheckDigit() { /** * {@inheritDoc} - * return expression overridden + *
+ * Overridden because the check digits are calculated as 97 - modulusResult + *
*/ @Override public String calculate(final String code) throws CheckDigitException { @@ -90,7 +90,6 @@ public boolean isValid(final String code) { if (code.length() < MIN_CODE_LEN) { return false; } - String check = code.substring(code.length() - CHECKDIGIT_LEN); Integer icheck = GenericTypeValidator.formatInt(check); if (icheck == null) { diff --git a/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBGCheckDigit.java b/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBGCheckDigit.java index a7650fcec..0856dff9f 100644 --- a/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBGCheckDigit.java +++ b/src/main/java/org/apache/commons/validator/routines/checkdigit/VATidBGCheckDigit.java @@ -55,10 +55,12 @@ public static CheckDigit getInstance() { } /** - * there ate three length - * 9 for legal entities (standard DDS), - * 10 for physical persons (civil number), - * 13 for legal entities with branch number (not used for VATIN) + * There are three length + *