Author: sebb
Date: Wed Sep 30 10:13:35 2015
New Revision: 1705993

URL: http://svn.apache.org/viewvc?rev=1705993&view=rev
Log:
Perform array check before checking for new TLDs
This makes it easier when manually adding new entries.

Modified:
    
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java

Modified: 
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java?rev=1705993&r1=1705992&r2=1705993&view=diff
==============================================================================
--- 
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
 (original)
+++ 
commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
 Wed Sep 30 10:13:35 2015
@@ -300,6 +300,16 @@ public class DomainValidatorTest extends
     // Check if the internal TLD table is up to date
     // Check if the internal TLD tables have any spurious entries
     public static void main(String a[]) throws Exception {
+        // Check the arrays first as this affects later checks
+        // Doing this here makes it easier when updating the lists
+        boolean OK = true;
+        for(String list : new 
String[]{"INFRASTRUCTURE_TLDS","COUNTRY_CODE_TLDS","GENERIC_TLDS","LOCAL_TLDS"})
 {
+            OK &= isSortedLowerCase(list);
+        }
+        if (!OK) {
+            System.out.println("Fix arrays before retrying; cannot continue");
+            return;
+        }
         Set<String> ianaTlds = new HashSet<String>(); // keep for comparison 
with array contents
         DomainValidator dv = DomainValidator.getInstance();;
         File txtFile = new File("target/tlds-alpha-by-domain.txt");
@@ -563,7 +573,7 @@ public class DomainValidatorTest extends
         return true;
     }
 
-    private boolean isSortedLowerCase(String arrayName) throws Exception {
+    private static boolean isSortedLowerCase(String arrayName) throws 
Exception {
         Field f = DomainValidator.class.getDeclaredField(arrayName);
         final boolean isPrivate = Modifier.isPrivate(f.getModifiers());
         if (isPrivate) {


Reply via email to