You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/07/21 15:00:03 UTC
(commons-validator) 01/02: Add IBANValidator.Validator.getIbanLength()
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git
commit 761d5983f1612a0f38220f92e071cb348d68ffd7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 21 10:59:50 2024 -0400
Add IBANValidator.Validator.getIbanLength()
---
pom.xml | 8 ++++----
src/changes/changes.xml | 3 ++-
.../apache/commons/validator/routines/IBANValidator.java | 16 +++++++++++++++-
.../commons/validator/routines/IBANValidatorTest.java | 2 +-
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 27c8131f..26663a4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
- <version>1.9.1-SNAPSHOT</version>
+ <version>1.10.0-SNAPSHOT</version>
<name>Apache Commons Validator</name>
<description>
Apache Commons Validator provides the building blocks for both client-side and server-side data validation.
@@ -40,11 +40,11 @@
<commons.componentid>validator</commons.componentid>
<commons.module.name>org.apache.commons.validator</commons.module.name>
<!-- Re-generate the download page using: mvn commons:download-page -->
- <commons.release.version>1.9.0</commons.release.version>
- <commons.release.next>1.9.1</commons.release.next>
+ <commons.release.version>1.10.0</commons.release.version>
+ <commons.release.next>1.10.1</commons.release.next>
<commons.rc.version>RC1</commons.rc.version>
<commons.release.desc>(requires JDK ${maven.compiler.target})</commons.release.desc>
- <commons.bc.version>1.8.0</commons.bc.version>
+ <commons.bc.version>1.9.0</commons.bc.version>
<commons.jira.id>VALIDATOR</commons.jira.id>
<commons.jira.pid>12310494</commons.jira.pid>
<commons.encoding>UTF-8</commons.encoding>
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index a0cb1bec..a3de3bc9 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,9 +64,10 @@ The <action> type attribute can be add,update,fix,remove.
-->
<body>
- <release version="1.9.1" date="YYYY-MM-DD" description="This is a maintenance and bug fix release; requires Java 8.">
+ <release version="1.10.0" date="YYYY-MM-DD" description="This is a maintenance and bug fix release; requires Java 8.">
<!-- FIX -->
<!-- ADD -->
+ <action type="update" dev="ggregory" due-to="Leonard Wicke, Gary Gregory">Add IBANValidator.Validator.getIbanLength().</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump org.apache.commons:commons-parent from 70 to 71 #231.</action>
<action type="update" dev="ggregory" due-to="Dependabot, Gary Gregory">Bump commons-logging:commons-logging from 1.3.2 to 1.3.3 #238.</action>
diff --git a/src/main/java/org/apache/commons/validator/routines/IBANValidator.java b/src/main/java/org/apache/commons/validator/routines/IBANValidator.java
index aa6136ca..68408207 100644
--- a/src/main/java/org/apache/commons/validator/routines/IBANValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/IBANValidator.java
@@ -69,7 +69,11 @@ public class IBANValidator {
final String countryCode;
final String[] otherCountryCodes;
final RegexValidator regexValidator;
- final int ibanLength; // used to avoid unnecessary regex matching
+
+ /**
+ * Used to avoid unnecessary regex matching.
+ */
+ private final int ibanLength;
/**
* Creates the validator.
@@ -109,6 +113,16 @@ public class IBANValidator {
this.regexValidator = new RegexValidator(regexList);
}
+ /**
+ * Gets the length.
+ *
+ * @return the length.
+ * @since 1.10.0
+ */
+ public int getIbanLength() {
+ return ibanLength;
+ }
+
/**
* Gets the RegexValidator.
*
diff --git a/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java b/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
index 29906333..d83900cc 100644
--- a/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
@@ -231,7 +231,7 @@ public class IBANValidatorTest {
System.out.println("// Missing entry:");
printEntry(cc.get(i), newLength, newRE, country.get(i));
} else {
- final String currentLength = Integer.toString(valre.ibanLength);
+ final String currentLength = Integer.toString(valre.getIbanLength());
final String currentRE = valre.getRegexValidator().toString().replaceAll("^.+?\\{(.+)}", "$1") // Extract RE from RegexValidator{re}
// string
.replace("\\d", "\\\\d"); // convert \d to \\d