Commit 248b61d3 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fixed bug in #getCurrentCountry(iso3) loop

parent 4e137696
......@@ -86,7 +86,7 @@ public class GeoServiceImpl implements GeoService {
Country.sort(countries, locale);
return countries;
}
@Override
public long countActive() {
return countryRepository.countByCurrent(true);
......@@ -172,16 +172,17 @@ public class GeoServiceImpl implements GeoService {
Country country = getCountry(code3);
if (country != null) {
if (country != null && country.getReplacedBy() != null) {
// Loop detection
Set<Long> seenCountryId = new HashSet<Long>();
while (!seenCountryId.contains(country.getId()) && country.getReplacedBy() != null) {
LOG.info("Country " + country.getCode3() + " replaced by " + country.getReplacedBy());
// Update reference
country = country.getReplacedBy();
// Put countryId to seen list
seenCountryId.add(country.getId());
// Update reference
country = country.getReplacedBy();
}
}
......@@ -401,7 +402,7 @@ public class GeoServiceImpl implements GeoService {
return itpgrfaRepository.save(itpgrfaStatus);
}
@Override
public String filteredKml(String jsonFilter) {
return null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment