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

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


The following commit(s) were added to refs/heads/master by this push:
     new 27f8781  VALIDATOR-471 : fix -- sort, downcase
27f8781 is described below

commit 27f878126b37b00998333c615ba1bd444f8b4383
Author: Sebb <s...@apache.org>
AuthorDate: Fri Jul 31 10:46:45 2020 +0100

    VALIDATOR-471 : fix -- sort, downcase
---
 .../apache/commons/validator/routines/DomainValidator.java | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/validator/routines/DomainValidator.java 
b/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
index 6cf8968..74fbee9 100644
--- a/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
@@ -206,21 +206,27 @@ public class DomainValidator implements Serializable {
 
         // apply the instance overrides
         for(Item item: items) {
+            String [] copy = new String[item.values.length];
+            // Comparisons are always done with lower-case entries
+            for (int i = 0; i < item.values.length; i++) {
+                copy[i] = item.values[i].toLowerCase(Locale.ENGLISH);
+            }
+            Arrays.sort(copy);
             switch(item.type) {
             case COUNTRY_CODE_MINUS: {
-                ccMinus = item.values.clone();
+                ccMinus = copy;
                 break;
             }
             case COUNTRY_CODE_PLUS: {
-                ccPlus = item.values.clone();
+                ccPlus = copy;
                 break;
             }
             case GENERIC_MINUS: {
-                genMinus = item.values.clone();
+                genMinus = copy;
                 break;
             }
             case GENERIC_PLUS: {
-                genPlus = item.values.clone();
+                genPlus = copy;
                 break;
             }
             default:

Reply via email to