commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (NET-269) Remove semi-redundant check in SubnetUtils.calculate()
Date Fri, 01 Apr 2011 02:12:06 GMT

     [ https://issues.apache.org/jira/browse/NET-269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved NET-269.
----------------------

       Resolution: Fixed
    Fix Version/s: 3.0

> Remove semi-redundant check in SubnetUtils.calculate()
> ------------------------------------------------------
>
>                 Key: NET-269
>                 URL: https://issues.apache.org/jira/browse/NET-269
>             Project: Commons Net
>          Issue Type: Improvement
>    Affects Versions: 2.0
>            Reporter: Sebb
>            Priority: Minor
>             Fix For: 3.0
>
>
> Remove semi-redundant check in SubnetUtils.calculate():
> As far as I can tell, the line
>      rangeCheck(pop(netmask),0, NBITS);
> in the calculate method can never fail the NBITS max bound, as the code has already checked
for NBITS-1.
> It will trap a mask with 0 bits - but then why not reject that earlier when checking
cidrPart?
> Seems wasteful to create pack and unpack the mask just to check for 0.
> It's also confusing to reject 32 bits before creating the mask, and then "allow" it later.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message