commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r586643 - in /commons/proper/validator/trunk/src: main/java/org/apache/commons/validator/routines/InetAddressValidator.java test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
Date Fri, 19 Oct 2007 23:55:51 GMT
Author: bspeakmon
Date: Fri Oct 19 16:55:51 2007
New Revision: 586643

URL: http://svn.apache.org/viewvc?rev=586643&view=rev
Log:
- allow 0.0.0.0 IP to validate; the UrlValidator tests require it and it's a legal subnet
address, if not host address.

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java?rev=586643&r1=586642&r2=586643&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/InetAddressValidator.java
Fri Oct 19 16:55:51 2007
@@ -73,7 +73,6 @@
         if (groups == null) return false;
 
         // verify that address subgroups are legal
-        int addrAccumulator = 0;
         for (int i = 0; i <= 3; i++) {
             String ipSegment = groups[i];
             if (ipSegment == null || ipSegment.length() <= 0) {
@@ -88,16 +87,11 @@
                 return false;
             }
 
-            addrAccumulator += iIpSegment;
-
             if (iIpSegment > 255) {
                 return false;
             }
 
         }
-
-        // verify that at least one bit of the address was set
-        if (addrAccumulator == 0) return false;
 
         return true;
     }

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java?rev=586643&r1=586642&r2=586643&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
(original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/routines/InetAddressValidatorTest.java
Fri Oct 19 16:55:51 2007
@@ -84,8 +84,6 @@
     public void testReservedInetAddresses() {
         assertTrue("localhost IP should be valid",            validator.isValid("127.0.0.1"));
         assertTrue("broadcast IP should be valid",            validator.isValid("255.255.255.255"));
-
-        assertFalse("empty IP shouldn't be valid",            validator.isValid("0.0.0.0"));
     }
 
     /**



Mime
View raw message