Skip to content

Commit

Permalink
throw excpetion if reader not initialised
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushaga14 committed Nov 22, 2024
1 parent 06e1f95 commit 896c930
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.akto.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.nio.file.Paths;

import com.akto.log.LoggerMaker;
import com.maxmind.geoip2.DatabaseReader;
Expand All @@ -18,12 +14,8 @@ public class IpGeolocation {
private static DatabaseReader reader;
private static final LoggerMaker loggerMaker = new LoggerMaker(IpGeolocation.class);

public IpGeolocation() {
try {
reader = new DatabaseReader.Builder(database).build();
} catch (Exception e) {
loggerMaker.errorAndAddToDb("IpGeolocation init failed " + e.getMessage());
}
public IpGeolocation() throws Exception {
reader = new DatabaseReader.Builder(database).build();
}

public String fetchLocationByIp(String ip) throws Exception {
Expand Down

0 comments on commit 896c930

Please sign in to comment.