You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2013/12/06 20:51:36 UTC
[jira] [Commented] (NET-513) [patch
attached]SubnetUtils.SubnetInfo.getAllAddresses() Doesn't return all
addresses
[ https://issues.apache.org/jira/browse/NET-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13841609#comment-13841609 ]
Gary Gregory commented on NET-513:
----------------------------------
Is it possible for you to provide your fix as a patch with a unit test?
> [patch attached]SubnetUtils.SubnetInfo.getAllAddresses() Doesn't return all addresses
> -------------------------------------------------------------------------------------
>
> Key: NET-513
> URL: https://issues.apache.org/jira/browse/NET-513
> Project: Commons Net
> Issue Type: Bug
> Affects Versions: 3.3
> Reporter: akash kushwaha
> Labels: easyfix, patch
>
> SubnetInfo.getAllAddresses() Doesn't return all addresses, but return all but 2 addresses.
> Fixing code at following lines worked for me.
> private int low() { return network() ; }
> private int high() { return broadcast() ; }
> public int getAddressCount() { return (broadcast() - low() + 1); }
> //j < addresses.length added as for loop will run infinitely when high is Integer.MAX_VALUE test case: 127.0.0.0/8
> for (int add = low(), j=0; add <= high() && j < addresses.length; ++add, ++j) {
--
This message was sent by Atlassian JIRA
(v6.1#6144)