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 2011/04/01 04:12:00 UTC

svn commit: r1087551 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/util/SubnetUtils.java

Author: sebb
Date: Fri Apr  1 02:12:00 2011
New Revision: 1087551

URL: http://svn.apache.org/viewvc?rev=1087551&view=rev
Log:
NET-269 Remove semi-redundant check in SubnetUtils.calculate()

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1087551&r1=1087550&r2=1087551&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Fri Apr  1 02:12:00 2011
@@ -57,6 +57,9 @@ The <action> type attribute can be add,u
 
     <body>
         <release version="3.0" date="TBA" description="TBA">
+            <action issue="NET-269" dev="sebb" type="update">
+            Remove semi-redundant check in SubnetUtils.calculate().
+            </action>
             <action issue="NET-396" dev="sebb" type="update">
             POP3.setState() should not be public.
             Deprecated, and changed to do nothing. Added package-private method for use by POP3 classes.

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java?rev=1087551&r1=1087550&r2=1087551&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/util/SubnetUtils.java Fri Apr  1 02:12:00 2011
@@ -202,13 +202,11 @@ public class SubnetUtils {
             address = matchAddress(matcher);
 
             /* Create a binary netmask from the number of bits specification /x */
-            int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), -1, NBITS);
+            int cidrPart = rangeCheck(Integer.parseInt(matcher.group(5)), 0, NBITS);
             for (int j = 0; j < cidrPart; ++j) {
                 netmask |= (1 << 31-j);
             }
 
-            rangeCheck(pop(netmask),0, NBITS);
-
             /* Calculate base network address */
             network = (address & netmask);