diff --git a/router/java/src/net/i2p/router/transport/GeoIP.java b/router/java/src/net/i2p/router/transport/GeoIP.java index 086c071eeb1bd6092a8dd3b596cd29a181b87b91..789fbe382bb032deb69c18647acc24521fffd8a0 100644 --- a/router/java/src/net/i2p/router/transport/GeoIP.java +++ b/router/java/src/net/i2p/router/transport/GeoIP.java @@ -174,7 +174,10 @@ public class GeoIP { // returns upper case or "--" String uc = ls.getCountry(ip).getCode(); if (!uc.equals(UNKNOWN_COUNTRY_CODE)) { - String cached = _codeCache.get(uc.toLowerCase(Locale.US)); + String lc = uc.toLowerCase(Locale.US); + String cached = _codeCache.get(lc); + if (cached == null) + cached = lc; _IPToCountry.put(ipl, cached); } else { _notFound.add(ipl); @@ -197,7 +200,10 @@ public class GeoIP { // returns upper case or null String uc = dbr.country(ipv4); if (uc != null) { - String cached = _codeCache.get(uc.toLowerCase(Locale.US)); + String lc = uc.toLowerCase(Locale.US); + String cached = _codeCache.get(lc); + if (cached == null) + cached = lc; _IPToCountry.put(ipl, cached); } else { _notFound.add(ipl); @@ -262,7 +268,10 @@ public class GeoIP { // returns upper case or null String uc = dbr.country(ipv6); if (uc != null) { - String cached = _codeCache.get(uc.toLowerCase(Locale.US)); + String lc = uc.toLowerCase(Locale.US); + String cached = _codeCache.get(lc); + if (cached == null) + cached = lc; _IPToCountry.put(ipl, cached); } else { _notFound.add(ipl);