Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VALIDATOR-496] IBANValidator: Fix IBAN 'c' pattern according to specification #294

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The <action> type attribute can be add,update,fix,remove.
<body>
<release version="1.10.0" date="YYYY-MM-DD" description="This is a maintenance and bug fix release; requires Java 8.">
<!-- FIX -->
<action type="fix" dev="sjaranowski" issue="VALIDATOR-496" due-to="Slawomir Jaranowski">IBANValidator: Fix IBAN 'c' pattern according to specification</action>
<action type="update" dev="sebb">DomainValidator: Changes from 2024121700, Last Updated Tue Dec 17 07:07:01 2024 UTC.</action>
<action type="update" dev="ggregory" due-to="Johannes Weberhofer">Fix order of actual and expected parameters in assertEquals() #246.</action>
<action type="update" dev="ggregory" due-to="Johannes Weberhofer">InetAddressValidator does not need its instance variable, so uses a touch less memory.</action>
Expand All @@ -76,7 +77,7 @@ The <action> type attribute can be add,update,fix,remove.
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump commons-logging:commons-logging from 1.3.2 to 1.3.4 #238, #254.</action>
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-lang3 from 3.15.0 to 3.17.0 #248, #257.</action>
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-csv from 1.11.0 to 1.12.0 #264.</action>
</elease>
</release>
<release version="1.9.0" date="2024-05-25" description="This is a maintenance and bug fix release; requires Java 8.">
<!-- ADD -->
<action type="add" dev="sebb" due-to="homebeaver">IBANValidator: #209 - add Falkland Islands, Mongolia, Nicaragua, Oman, Somalia</action>
Expand Down
176 changes: 88 additions & 88 deletions src/main/java/org/apache/commons/validator/routines/IBANValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,95 +139,95 @@ public RegexValidator getRegexValidator() {

private static final int SHORT_CODE_LEN = 2;

private static final Validator[] DEFAULT_VALIDATORS = { //
new Validator("AD", 24, "AD\\d{10}[A-Z0-9]{12}"), // Andorra
new Validator("AE", 23, "AE\\d{21}"), // United Arab Emirates (The)
new Validator("AL", 28, "AL\\d{10}[A-Z0-9]{16}"), // Albania
new Validator("AT", 20, "AT\\d{18}"), // Austria
new Validator("AZ", 28, "AZ\\d{2}[A-Z]{4}[A-Z0-9]{20}"), // Azerbaijan
new Validator("BA", 20, "BA\\d{18}"), // Bosnia and Herzegovina
new Validator("BE", 16, "BE\\d{14}"), // Belgium
new Validator("BG", 22, "BG\\d{2}[A-Z]{4}\\d{6}[A-Z0-9]{8}"), // Bulgaria
new Validator("BH", 22, "BH\\d{2}[A-Z]{4}[A-Z0-9]{14}"), // Bahrain
new Validator("BI", 27, "BI\\d{25}"), // Burundi
new Validator("BR", 29, "BR\\d{25}[A-Z]{1}[A-Z0-9]{1}"), // Brazil
new Validator("BY", 28, "BY\\d{2}[A-Z0-9]{4}\\d{4}[A-Z0-9]{16}"), // Republic of Belarus
new Validator("CH", 21, "CH\\d{7}[A-Z0-9]{12}"), // Switzerland
new Validator("CR", 22, "CR\\d{20}"), // Costa Rica
new Validator("CY", 28, "CY\\d{10}[A-Z0-9]{16}"), // Cyprus
new Validator("CZ", 24, "CZ\\d{22}"), // Czechia
new Validator("DE", 22, "DE\\d{20}"), // Germany
new Validator("DJ", 27, "DJ\\d{25}"), // Djibouti
new Validator("DK", 18, "DK\\d{16}"), // Denmark
new Validator("DO", 28, "DO\\d{2}[A-Z0-9]{4}\\d{20}"), // Dominican Republic
new Validator("EE", 20, "EE\\d{18}"), // Estonia
new Validator("EG", 29, "EG\\d{27}"), // Egypt
new Validator("ES", 24, "ES\\d{22}"), // Spain
new Validator("FI", 18, "\\d{16}", "AX"), // Finland
new Validator("FK", 18, "FK\\d{2}[A-Z]{2}\\d{12}"), // Falkland Islands, since Jul-23
new Validator("FO", 18, "FO\\d{16}"), // Faroe Islands
new Validator("FR", 27, "\\d{12}[A-Z0-9]{11}\\d{2}", "GF", "GP", "MQ", "RE", "PF", "TF", "YT", "NC", "BL", "MF", "PM", "WF"), // France
private static final Validator[] DEFAULT_VALIDATORS = { //
new Validator("AD", 24, "AD\\d{10}[A-Za-z0-9]{12}"), // Andorra
new Validator("AE", 23, "AE\\d{21}"), // United Arab Emirates (The)
new Validator("AL", 28, "AL\\d{10}[A-Za-z0-9]{16}"), // Albania
new Validator("AT", 20, "AT\\d{18}"), // Austria
new Validator("AZ", 28, "AZ\\d{2}[A-Z]{4}[A-Za-z0-9]{20}"), // Azerbaijan
new Validator("BA", 20, "BA\\d{18}"), // Bosnia and Herzegovina
new Validator("BE", 16, "BE\\d{14}"), // Belgium
new Validator("BG", 22, "BG\\d{2}[A-Z]{4}\\d{6}[A-Za-z0-9]{8}"), // Bulgaria
new Validator("BH", 22, "BH\\d{2}[A-Z]{4}[A-Za-z0-9]{14}"), // Bahrain
new Validator("BI", 27, "BI\\d{25}"), // Burundi
new Validator("BR", 29, "BR\\d{25}[A-Z]{1}[A-Za-z0-9]{1}"), // Brazil
new Validator("BY", 28, "BY\\d{2}[A-Za-z0-9]{4}\\d{4}[A-Za-z0-9]{16}"), // Republic of Belarus
new Validator("CH", 21, "CH\\d{7}[A-Za-z0-9]{12}"), // Switzerland
new Validator("CR", 22, "CR\\d{20}"), // Costa Rica
new Validator("CY", 28, "CY\\d{10}[A-Za-z0-9]{16}"), // Cyprus
new Validator("CZ", 24, "CZ\\d{22}"), // Czechia
new Validator("DE", 22, "DE\\d{20}"), // Germany
new Validator("DJ", 27, "DJ\\d{25}"), // Djibouti
new Validator("DK", 18, "DK\\d{16}"), // Denmark
new Validator("DO", 28, "DO\\d{2}[A-Za-z0-9]{4}\\d{20}"), // Dominican Republic
new Validator("EE", 20, "EE\\d{18}"), // Estonia
new Validator("EG", 29, "EG\\d{27}"), // Egypt
new Validator("ES", 24, "ES\\d{22}"), // Spain
new Validator("FI", 18, "\\d{16}", "AX"), // Finland
new Validator("FK", 18, "FK\\d{2}[A-Z]{2}\\d{12}"), // Falkland Islands, since Jul-23
new Validator("FO", 18, "FO\\d{16}"), // Faroe Islands
new Validator("FR", 27, "\\d{12}[A-Za-z0-9]{11}\\d{2}", "GF", "GP", "MQ", "RE", "PF", "TF", "YT", "NC", "BL", "MF", "PM", "WF"), // France
new Validator("GB", 22, "\\d{2}[A-Z]{4}\\d{14}", "IM", "JE", "GG"), // United Kingdom
new Validator("GE", 22, "GE\\d{2}[A-Z]{2}\\d{16}"), // Georgia
new Validator("GI", 23, "GI\\d{2}[A-Z]{4}[A-Z0-9]{15}"), // Gibraltar
new Validator("GL", 18, "GL\\d{16}"), // Greenland
new Validator("GR", 27, "GR\\d{9}[A-Z0-9]{16}"), // Greece
new Validator("GT", 28, "GT\\d{2}[A-Z0-9]{24}"), // Guatemala
new Validator("HR", 21, "HR\\d{19}"), // Croatia
new Validator("HU", 28, "HU\\d{26}"), // Hungary
new Validator("IE", 22, "IE\\d{2}[A-Z]{4}\\d{14}"), // Ireland
new Validator("IL", 23, "IL\\d{21}"), // Israel
new Validator("IQ", 23, "IQ\\d{2}[A-Z]{4}\\d{15}"), // Iraq
new Validator("IS", 26, "IS\\d{24}"), // Iceland
new Validator("IT", 27, "IT\\d{2}[A-Z]{1}\\d{10}[A-Z0-9]{12}"), // Italy
new Validator("JO", 30, "JO\\d{2}[A-Z]{4}\\d{4}[A-Z0-9]{18}"), // Jordan
new Validator("KW", 30, "KW\\d{2}[A-Z]{4}[A-Z0-9]{22}"), // Kuwait
new Validator("KZ", 20, "KZ\\d{5}[A-Z0-9]{13}"), // Kazakhstan
new Validator("LB", 28, "LB\\d{6}[A-Z0-9]{20}"), // Lebanon
new Validator("LC", 32, "LC\\d{2}[A-Z]{4}[A-Z0-9]{24}"), // Saint Lucia
new Validator("LI", 21, "LI\\d{7}[A-Z0-9]{12}"), // Liechtenstein
new Validator("LT", 20, "LT\\d{18}"), // Lithuania
new Validator("LU", 20, "LU\\d{5}[A-Z0-9]{13}"), // Luxembourg
new Validator("LV", 21, "LV\\d{2}[A-Z]{4}[A-Z0-9]{13}"), // Latvia
new Validator("LY", 25, "LY\\d{23}"), // Libya
new Validator("MC", 27, "MC\\d{12}[A-Z0-9]{11}\\d{2}"), // Monaco
new Validator("MD", 24, "MD\\d{2}[A-Z0-9]{20}"), // Moldova
new Validator("ME", 22, "ME\\d{20}"), // Montenegro
new Validator("MK", 19, "MK\\d{5}[A-Z0-9]{10}\\d{2}"), // Macedonia
new Validator("MN", 20, "MN\\d{18}"), // Mongolia, since Apr-23
new Validator("MR", 27, "MR\\d{25}"), // Mauritania
new Validator("MT", 31, "MT\\d{2}[A-Z]{4}\\d{5}[A-Z0-9]{18}"), // Malta
new Validator("MU", 30, "MU\\d{2}[A-Z]{4}\\d{19}[A-Z]{3}"), // Mauritius
new Validator("NI", 28, "NI\\d{2}[A-Z]{4}\\d{20}"), // Nicaragua, since Apr-23
new Validator("NL", 18, "NL\\d{2}[A-Z]{4}\\d{10}"), // Netherlands (The)
new Validator("NO", 15, "NO\\d{13}"), // Norway
new Validator("OM", 23, "OM\\d{5}[A-Z0-9]{16}"), // Oman, since Mar-24
new Validator("PK", 24, "PK\\d{2}[A-Z]{4}[A-Z0-9]{16}"), // Pakistan
new Validator("PL", 28, "PL\\d{26}"), // Poland
new Validator("PS", 29, "PS\\d{2}[A-Z]{4}[A-Z0-9]{21}"), // Palestine, State of
new Validator("PT", 25, "PT\\d{23}"), // Portugal
new Validator("QA", 29, "QA\\d{2}[A-Z]{4}[A-Z0-9]{21}"), // Qatar
new Validator("RO", 24, "RO\\d{2}[A-Z]{4}[A-Z0-9]{16}"), // Romania
new Validator("RS", 22, "RS\\d{20}"), // Serbia
new Validator("RU", 33, "RU\\d{16}[A-Z0-9]{15}"), // Russia
new Validator("SA", 24, "SA\\d{4}[A-Z0-9]{18}"), // Saudi Arabia
new Validator("SC", 31, "SC\\d{2}[A-Z]{4}\\d{20}[A-Z]{3}"), // Seychelles
new Validator("SD", 18, "SD\\d{16}"), // Sudan
new Validator("SE", 24, "SE\\d{22}"), // Sweden
new Validator("SI", 19, "SI\\d{17}"), // Slovenia
new Validator("SK", 24, "SK\\d{22}"), // Slovakia
new Validator("SM", 27, "SM\\d{2}[A-Z]{1}\\d{10}[A-Z0-9]{12}"), // San Marino
new Validator("SO", 23, "SO\\d{21}"), // Somalia, since Feb-23
new Validator("ST", 25, "ST\\d{23}"), // Sao Tome and Principe
new Validator("SV", 28, "SV\\d{2}[A-Z]{4}\\d{20}"), // El Salvador
new Validator("TL", 23, "TL\\d{21}"), // Timor-Leste
new Validator("TN", 24, "TN\\d{22}"), // Tunisia
new Validator("TR", 26, "TR\\d{8}[A-Z0-9]{16}"), // Turkey
new Validator("UA", 29, "UA\\d{8}[A-Z0-9]{19}"), // Ukraine
new Validator("VA", 22, "VA\\d{20}"), // Vatican City State
new Validator("VG", 24, "VG\\d{2}[A-Z]{4}\\d{16}"), // Virgin Islands
new Validator("XK", 20, "XK\\d{18}"), // Kosovo
new Validator("YE", 30, "YE\\d{2}[A-Z]{4}\\d{4}[A-Z0-9]{18}"), // Yemen
new Validator("GE", 22, "GE\\d{2}[A-Z]{2}\\d{16}"), // Georgia
new Validator("GI", 23, "GI\\d{2}[A-Z]{4}[A-Za-z0-9]{15}"), // Gibraltar
new Validator("GL", 18, "GL\\d{16}"), // Greenland
new Validator("GR", 27, "GR\\d{9}[A-Za-z0-9]{16}"), // Greece
new Validator("GT", 28, "GT\\d{2}[A-Za-z0-9]{24}"), // Guatemala
new Validator("HR", 21, "HR\\d{19}"), // Croatia
new Validator("HU", 28, "HU\\d{26}"), // Hungary
new Validator("IE", 22, "IE\\d{2}[A-Z]{4}\\d{14}"), // Ireland
new Validator("IL", 23, "IL\\d{21}"), // Israel
new Validator("IQ", 23, "IQ\\d{2}[A-Z]{4}\\d{15}"), // Iraq
new Validator("IS", 26, "IS\\d{24}"), // Iceland
new Validator("IT", 27, "IT\\d{2}[A-Z]{1}\\d{10}[A-Za-z0-9]{12}"), // Italy
new Validator("JO", 30, "JO\\d{2}[A-Z]{4}\\d{4}[A-Za-z0-9]{18}"), // Jordan
new Validator("KW", 30, "KW\\d{2}[A-Z]{4}[A-Za-z0-9]{22}"), // Kuwait
new Validator("KZ", 20, "KZ\\d{5}[A-Za-z0-9]{13}"), // Kazakhstan
new Validator("LB", 28, "LB\\d{6}[A-Za-z0-9]{20}"), // Lebanon
new Validator("LC", 32, "LC\\d{2}[A-Z]{4}[A-Za-z0-9]{24}"), // Saint Lucia
new Validator("LI", 21, "LI\\d{7}[A-Za-z0-9]{12}"), // Liechtenstein
new Validator("LT", 20, "LT\\d{18}"), // Lithuania
new Validator("LU", 20, "LU\\d{5}[A-Za-z0-9]{13}"), // Luxembourg
new Validator("LV", 21, "LV\\d{2}[A-Z]{4}[A-Za-z0-9]{13}"), // Latvia
new Validator("LY", 25, "LY\\d{23}"), // Libya
new Validator("MC", 27, "MC\\d{12}[A-Za-z0-9]{11}\\d{2}"), // Monaco
new Validator("MD", 24, "MD\\d{2}[A-Za-z0-9]{20}"), // Moldova
new Validator("ME", 22, "ME\\d{20}"), // Montenegro
new Validator("MK", 19, "MK\\d{5}[A-Za-z0-9]{10}\\d{2}"), // Macedonia
new Validator("MN", 20, "MN\\d{18}"), // Mongolia, since Apr-23
new Validator("MR", 27, "MR\\d{25}"), // Mauritania
new Validator("MT", 31, "MT\\d{2}[A-Z]{4}\\d{5}[A-Za-z0-9]{18}"), // Malta
new Validator("MU", 30, "MU\\d{2}[A-Z]{4}\\d{19}[A-Z]{3}"), // Mauritius
new Validator("NI", 28, "NI\\d{2}[A-Z]{4}\\d{20}"), // Nicaragua, since Apr-23
new Validator("NL", 18, "NL\\d{2}[A-Z]{4}\\d{10}"), // Netherlands (The)
new Validator("NO", 15, "NO\\d{13}"), // Norway
new Validator("OM", 23, "OM\\d{5}[A-Za-z0-9]{16}"), // Oman, since Mar-24
new Validator("PK", 24, "PK\\d{2}[A-Z]{4}[A-Za-z0-9]{16}"), // Pakistan
new Validator("PL", 28, "PL\\d{26}"), // Poland
new Validator("PS", 29, "PS\\d{2}[A-Z]{4}[A-Za-z0-9]{21}"), // Palestine, State of
new Validator("PT", 25, "PT\\d{23}"), // Portugal
new Validator("QA", 29, "QA\\d{2}[A-Z]{4}[A-Za-z0-9]{21}"), // Qatar
new Validator("RO", 24, "RO\\d{2}[A-Z]{4}[A-Za-z0-9]{16}"), // Romania
new Validator("RS", 22, "RS\\d{20}"), // Serbia
new Validator("RU", 33, "RU\\d{16}[A-Za-z0-9]{15}"), // Russia
new Validator("SA", 24, "SA\\d{4}[A-Za-z0-9]{18}"), // Saudi Arabia
new Validator("SC", 31, "SC\\d{2}[A-Z]{4}\\d{20}[A-Z]{3}"), // Seychelles
new Validator("SD", 18, "SD\\d{16}"), // Sudan
new Validator("SE", 24, "SE\\d{22}"), // Sweden
new Validator("SI", 19, "SI\\d{17}"), // Slovenia
new Validator("SK", 24, "SK\\d{22}"), // Slovakia
new Validator("SM", 27, "SM\\d{2}[A-Z]{1}\\d{10}[A-Za-z0-9]{12}"), // San Marino
new Validator("SO", 23, "SO\\d{21}"), // Somalia, since Feb-23
new Validator("ST", 25, "ST\\d{23}"), // Sao Tome and Principe
new Validator("SV", 28, "SV\\d{2}[A-Z]{4}\\d{20}"), // El Salvador
new Validator("TL", 23, "TL\\d{21}"), // Timor-Leste
new Validator("TN", 24, "TN\\d{22}"), // Tunisia
new Validator("TR", 26, "TR\\d{8}[A-Za-z0-9]{16}"), // Turkey
new Validator("UA", 29, "UA\\d{8}[A-Za-z0-9]{19}"), // Ukraine
new Validator("VA", 22, "VA\\d{20}"), // Vatican City State
new Validator("VG", 24, "VG\\d{2}[A-Z]{4}\\d{16}"), // Virgin Islands
new Validator("XK", 20, "XK\\d{18}"), // Kosovo
new Validator("YE", 30, "YE\\d{2}[A-Z]{4}\\d{4}[A-Za-z0-9]{18}"), // Yemen
};

/*
Expand Down
Loading
Loading