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 2023/01/16 16:41:51 UTC

[commons-validator] branch master updated (d598b943 -> af0035cc)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


    from d598b943 Format tweak
     new 69bc8e38 Fix entry
     new af0035cc Add IBANValidator.Validator.getRegexValidator().

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                  |  7 +++++--
 .../apache/commons/validator/routines/IBANValidator.java | 16 +++++++++++++---
 .../commons/validator/routines/IBANValidatorTest.java    |  2 +-
 3 files changed, 19 insertions(+), 6 deletions(-)


[commons-validator] 02/02: Add IBANValidator.Validator.getRegexValidator().

Posted by gg...@apache.org.
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 af0035cc7a34729b5866bcddb9b8056f8ff5e2f0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 16 11:41:46 2023 -0500

    Add IBANValidator.Validator.getRegexValidator().
---
 src/changes/changes.xml                                  |  3 +++
 .../apache/commons/validator/routines/IBANValidator.java | 16 +++++++++++++---
 .../commons/validator/routines/IBANValidatorTest.java    |  2 +-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ed16a760..4a7c4b6d 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -85,6 +85,9 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="VALIDATOR-486" type="add" dev="ggregory" due-to="tatiana-scda, Gary Gregory">
       Add new countries to IBAN list: DJ, RU #88.
     </action>
+    <action type="add" dev="ggregory" due-to="Arnaud Fournier, Gary Gregory">
+      Add IBANValidator.Validator.getRegexValidator().
+    </action>
     <!-- REMOVE -->
     <action type="remove" dev="ggregory" due-to="John Patrick, Gary Gregory">
       Remove FindBugs, SpotBugs is in use #87.
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 a5fd4a9e..4174f5c8 100644
--- a/src/main/java/org/apache/commons/validator/routines/IBANValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/IBANValidator.java
@@ -66,7 +66,7 @@ public class IBANValidator {
         private static final int MIN_LEN = 8;
         private static final int MAX_LEN = 34; // defined by [3]
         final String countryCode;
-        final RegexValidator validator;
+        final RegexValidator regexValidator;
         final int lengthOfIBAN; // used to avoid unnecessary regex matching
 
         /**
@@ -87,7 +87,17 @@ public class IBANValidator {
             }
             this.countryCode = cc;
             this.lengthOfIBAN = len;
-            this.validator = new RegexValidator(format);
+            this.regexValidator = new RegexValidator(format);
+        }
+
+        /**
+         * Gets the RegexValidator.
+         *
+         * @return the RegexValidator.
+         * @since 1.8
+         */
+        public RegexValidator getRegexValidator() {
+            return regexValidator;
         }
     }
 
@@ -248,7 +258,7 @@ public class IBANValidator {
      */
     public boolean isValid(final String code) {
         final Validator formatValidator = getValidator(code);
-        if (formatValidator == null || code.length() != formatValidator.lengthOfIBAN || !formatValidator.validator.isValid(code)) {
+        if (formatValidator == null || code.length() != formatValidator.lengthOfIBAN || !formatValidator.regexValidator.isValid(code)) {
             return false;
         }
         return IBANCheckDigit.IBAN_CHECK_DIGIT.isValid(code);
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 ed794fb3..9147a1ac 100644
--- a/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
+++ b/src/test/java/org/apache/commons/validator/routines/IBANValidatorTest.java
@@ -288,7 +288,7 @@ public class IBANValidatorTest {
                         country.get(i));
             } else {
                 final String currentLength = Integer.toString(valre.lengthOfIBAN);
-                final String currentRE = valre.validator.toString()
+                final String currentRE = valre.getRegexValidator().toString()
                         .replaceAll("^.+?\\{(.+)}","$1") // Extract RE from RegexValidator{re} string
                         .replace("\\d","\\\\d"); // convert \d to \\d
                 // The above assumes that the RegexValidator contains a single Regex


[commons-validator] 01/02: Fix entry

Posted by gg...@apache.org.
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 69bc8e38976c8ee194d64334b2e2c3ecad2fb880
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 16 11:41:18 2023 -0500

    Fix entry
---
 src/changes/changes.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b1b0bb8d..ed16a760 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -79,10 +79,10 @@ The <action> type attribute can be add,update,fix,remove.
     <action type="add" dev="ggregory" due-to="Dependabot, Gary Gregory">
       Add github/codeql-action.
     </action>
-    <action issue="VALIDATOR-477" type="update" dev="sebb" due-to="sebb, homebeaver">
+    <action issue="VALIDATOR-477" type="adda" dev="sebb" due-to="sebb, homebeaver">
       Add IBAN validators for LY – Libya, SD, BI, #67.
     </action>
-    <action issue="VALIDATOR-486" type="update" dev="sebb" due-to="tatiana-scda, Gary Gregory">
+    <action issue="VALIDATOR-486" type="add" dev="ggregory" due-to="tatiana-scda, Gary Gregory">
       Add new countries to IBAN list: DJ, RU #88.
     </action>
     <!-- REMOVE -->