You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2020/06/21 12:17:07 UTC

[commons-validator] branch master updated: Docs

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 df57d61  Docs
df57d61 is described below

commit df57d61dff8823b41c37184ce8927e59d749914c
Author: Sebb <se...@apache.org>
AuthorDate: Sun Jun 21 13:16:59 2020 +0100

    Docs
---
 .../apache/commons/validator/routines/DomainValidator.java   | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

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 4c38c67..4dc31f3 100644
--- a/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
+++ b/src/main/java/org/apache/commons/validator/routines/DomainValidator.java
@@ -63,6 +63,7 @@ import java.util.Locale;
  */
 public class DomainValidator implements Serializable {
 
+    /** Maximum allowable length ({@value}) of a domain name */
     private static final int MAX_DOMAIN_LENGTH = 253;
 
     private static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -102,6 +103,11 @@ public class DomainValidator implements Serializable {
     private static final DomainValidator DOMAIN_VALIDATOR_WITH_LOCAL = new DomainValidator(true);
 
     /**
+     * The above instances must only be returned via the getInstance() methods.
+     * This is to ensure that the override data arrays are properly protected.
+     */
+
+    /**
      * RegexValidator for matching domains.
      */
     private final RegexValidator domainRegex =
@@ -137,7 +143,11 @@ public class DomainValidator implements Serializable {
         return DOMAIN_VALIDATOR;
     }
 
-    /** Private constructor. */
+    /**
+     * Private constructor. 
+     * This does not set the inUse flag - that is done by getInstance.
+     * This is to allow the static shared instances to be created.
+    */
     private DomainValidator(boolean allowLocal) {
         this.allowLocal = allowLocal;
     }