commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r740965 - /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
Date Thu, 05 Feb 2009 01:11:03 GMT
Author: rwinston
Date: Thu Feb  5 01:11:02 2009
New Revision: 740965

URL: http://svn.apache.org/viewvc?rev=740965&view=rev
Log:
NET-236 Catch lower address ranges in isInRange()

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=740965&r1=740964&r2=740965&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/util/SubnetUtils.java
Thu Feb  5 01:11:02 2009
@@ -70,7 +70,11 @@
         private int high()          { return broadcast() - 1; }
 
         public boolean isInRange(String address)    { return isInRange(toInteger(address));
}
-        private boolean isInRange(int address)      { return ((address-low()) <= (high()-low()));
}
+        
+        private boolean isInRange(int address)      { 
+            int diff = address-low();
+            return (diff >= 0 && (diff <= (high()-low())));
+        }
 
         public String getBroadcastAddress()         { return format(toArray(broadcast()));
}
         public String getNetworkAddress()           { return format(toArray(network()));
}



Mime
View raw message