(geo-ip) Tidy up error handling

This commit is contained in:
Viktor Lofgren 2023-12-17 15:26:57 +01:00
parent 7797de80e3
commit c422f0b9fb
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,8 @@
package nu.marginalia.geoip.sources; package nu.marginalia.geoip.sources;
import com.opencsv.CSVReader; import com.opencsv.CSVReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.file.Files; import java.nio.file.Files;
@ -9,6 +11,7 @@ import java.nio.file.Path;
/** Load an IP2LOCATION LITE database file and provide a method to look up the country for an IP address. /** Load an IP2LOCATION LITE database file and provide a method to look up the country for an IP address.
*/ */
public class IP2LocationMapping { public class IP2LocationMapping {
private static final Logger logger = LoggerFactory.getLogger(IP2LocationMapping.class);
private final IpRangeMapping<String> ranges = new IpRangeMapping<>(); private final IpRangeMapping<String> ranges = new IpRangeMapping<>();
public IP2LocationMapping(Path filename) { public IP2LocationMapping(Path filename) {
@ -22,7 +25,7 @@ public class IP2LocationMapping {
ranges.add(Integer.parseUnsignedInt(vals[0]), Integer.parseUnsignedInt(vals[1]), vals[2]); ranges.add(Integer.parseUnsignedInt(vals[0]), Integer.parseUnsignedInt(vals[1]), vals[2]);
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); logger.info("Failed to load IP2Location database " + filename, e);
} }
} }

View File

@ -199,9 +199,6 @@ public class DomainProcessor {
if (org.contains("ALIBABA")) { if (org.contains("ALIBABA")) {
return true; return true;
} }
if (org.contains("CLOUDFLARE")) {
return true;
}
return false; return false;
} }