8000 fix: handle invalid ip address · messede-degod/sstable-migrator@50e1762 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
fix: handle invalid ip address
Browse files Browse the repository at this point in the history
  • Loading branch information
messede-degod committed Mar 3, 2024
1 parent 98ce245 commit 50e1762
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/segfault/sstableMigrator/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.maxmind.db.MaxMindDbParameter;
import com.maxmind.db.Reader;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -243,7 +244,13 @@ public void parseAndInsertCSV(String csvString) throws IOException, SkippedEntry
InetAddress ip16 = null;
InetAddress ip24 = null;

try{
parsedIpAddress = InetAddress.getByName(ipStr);
}catch(UnknownHostException e){
System.out.println("Invalid Ip Address: "+csvString);
return;
}

ip8 = App.getIPBlock(parsedIpAddress, (short) 8);
ip16 = App.getIPBlock(parsedIpAddress, (short) 16);
ip24 = App.getIPBlock(parsedIpAddress, (short) 24);
Expand Down

0 comments on commit 50e1762

Please sign in to comment.
0