commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andris Rauda (JIRA)" <>
Subject [jira] Created: (NET-260) SubnetUtils.SubnetInfo.isInRange(...) returns incorrect values
Date Tue, 10 Mar 2009 12:54:50 GMT
SubnetUtils.SubnetInfo.isInRange(...) returns incorrect values

                 Key: NET-260
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Andris Rauda

SubnetUtils class handles IP addresses as int (which in Java is signed).
isInRange() method does not take this into account:
private boolean isInRange(int address) {
    return ((address-low()) <= (high()-low()));

In following code snippet isInRange() returns true, when clearly is outside the
range: -
        String cidrNotation = "";
        SubnetUtils.SubnetInfo info = new SubnetUtils(cidrNotation).getInfo();
        assertFalse(info.isInRange("")); // fails

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message