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


The following commit(s) were added to refs/heads/master by this push:
     new 3d44f53  Fix typo in comment. Raise embedded if into parent if.
3d44f53 is described below

commit 3d44f5369ca98a671827b7dcf41771a8cb90a3d0
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Feb 28 12:50:54 2021 -0500

    Fix typo in comment. Raise embedded if into parent if.
---
 .../commons/validator/routines/InetAddressValidator.java      | 11 +++++------
 .../commons/validator/routines/DomainValidatorTest.java       |  6 ++----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java 
b/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
index 48dec81..47066f1 100644
--- 
a/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
+++ 
b/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
@@ -148,12 +148,11 @@ public class InetAddressValidator implements Serializable 
{
         parts = parts[0].split("%", -1);
         if (parts.length > 2) {
             return false;
-        } else if (parts.length == 2){
-            // The id syntax is implemenatation independent, but it presumably 
cannot allow:
-            // whitespace, '/' or '%'
-            if (!parts[1].matches("[^\\s/%]+")) {
-                return false; // invalid id
-            }
+        } else 
+        // The id syntax is implementation independent, but it presumably 
cannot allow:
+        // whitespace, '/' or '%'
+        if ((parts.length == 2) && !parts[1].matches("[^\\s/%]+")) {
+            return false; // invalid id
         }
         inet6Address = parts[0];
         boolean containsCompressedZeroes = inet6Address.contains("::");
diff --git 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
index 47ab560..5a74cef 100644
--- 
a/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
+++ 
b/src/test/java/org/apache/commons/validator/routines/DomainValidatorTest.java
@@ -385,10 +385,8 @@ public class DomainValidatorTest extends TestCase {
                 }
                 ianaTlds.add(asciiTld);
                 // Don't merge these conditions; generateUnicodeTlds is final 
so needs to be separate to avoid a warning
-                if (generateUnicodeTlds) {
-                    if (!unicodeTld.equals(asciiTld)) {
-                        ianaTlds.add(unicodeTld);
-                    }
+                if (generateUnicodeTlds && !unicodeTld.equals(asciiTld)) {
+                    ianaTlds.add(unicodeTld);
                 }
             }
         }

Reply via email to