for (final SecLoginlog secLoginlog : originList) {
count++;
// check if no entry exists for this login
if (secLoginlog.getIp2Country() == null) {
IpToCountry ipToCountry = null;
try {
// try to get a ipToCountry for the IP from the table
final InetAddress inetAddress = InetAddress.getByName(secLoginlog.getLglIp());
// Skip a local ip. Therefore is no country to identify.
if (inetAddress.isLoopbackAddress() || inetAddress.isSiteLocalAddress()) {
localCount++;
continue;
}
checkCount++;
ipToCountry = getIpToCountryService().getIpToCountry(inetAddress);
// if found than get the CountryCode object for it and save
// all
if (ipToCountry != null) {
final String code2 = ipToCountry.getIpcCountryCode2();
final CountryCode sysCC = getCountryCodeService().getCountryCodeByCode2(code2);
if (sysCC != null) {
final Ip2Country ip2 = getIp2CountryService().getNewIp2Country();
ip2.setCountryCode(sysCC);