commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: NET SubnetUtil exception on /31 and /32
Date Tue, 01 Nov 2011 14:04:32 GMT
On 1 November 2011 08:11, Maurizio Cucchiara <mcucchiara@apache.org> wrote:
> You should include the network and broadcast addresses
> Try this
>
> public void testMail() throws Exception {
>        final SubnetUtils subnetUtils = new SubnetUtils("1.2.3.4/32");
>        subnetUtils.setInclusiveHostCount(true);

That fixes the error by increasing the available address count, but I
agree with the OP that the current behaviour is unexpected - it would
make more sense to return an empty array rather than throwing
ArrayIndexOutOfBoundsException.

So I created:

https://issues.apache.org/jira/browse/NET-428


>        String[] address = subnetUtils.getInfo().getAllAddresses();
>        assertNotNull(address);
>        assertEquals(1,address.length);
>    }
>
>
> Twitter     :http://www.twitter.com/m_cucchiara
> G+          :https://plus.google.com/107903711540963855921
> Linkedin    :http://www.linkedin.com/in/mauriziocucchiara
>
> Maurizio Cucchiara
>
>
>
> 2011/11/1 Kanatoko <anvil@jumperz.net>:
>> new SubnetUtils( "1.2.3.4/32" ).getInfo().getAllAddresses()
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message