Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ip_address.iad_type value is ignored when the object is loaded from database #13

Open
TheRedTrainer opened this issue Nov 2, 2017 · 2 comments

Comments

@TheRedTrainer
Copy link

When a ip address is loaded from database (according to mx.nic.rdap.sql.objects.IpAddressDbObj.java class), all the data is setted with db values, except the internet address type as it is showed in the following method loadFromDatabase:

public void loadFromDatabase(ResultSet resultSet) throws SQLException {
this.setId(resultSet.getLong("iad_id"));
this.setNameserverId(resultSet.getLong("nse_id"));
try {
this.setAddress(InetAddress.getByName(resultSet.getString("iad_value")));
} catch (UnknownHostException e) {
// The address is validate in the store process,so this exception
// will never be throw.
}
if (this.getAddress() instanceof Inet4Address) {
this.setType(4);
} else if (this.getAddress() instanceof Inet6Address) {
this.setType(6);
}

}

Ip Address type attribute is setted in a validation of the instance of inet address, but the iad_type value from db is never accessed. It is necessary to obtain the ip address type from db and, if it is necessary, validate it with the instance of inet address, in order to confirm or throw an exception.

@pcarana pcarana added this to the v1.1.1 milestone Nov 7, 2017
@dhfelix
Copy link
Contributor

dhfelix commented Nov 7, 2017

When the object IpAddress is loaded as a property of a nameserver object, it is not critical to load the column "iad_type" from the database.

The column "iad_type" is used when a partial search is requested (more specific, at the /nameservers/nsIp=XXX request), with this column is easier to search only information of that kind of IP version, and do not perform a full table scan. As our project RDAP does not store data in the database, the project do not have control if the iad_type and the value of the IP match when performing a search.

In conclusion, the column "iad_type" is useful as a filter when the user requests a search.

@dhfelix dhfelix added the solved label Nov 7, 2017
@TheRedTrainer
Copy link
Author

Verified and agreed. However, talking about with @pcarana , it could be an enhancement to add comments related to that fact to the code, scripts and web site, in order to explain this behaviour that could be misunderstood by other developers. This issue will be closed and a new enhancement will be reported to explain the situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants