From d1bdfc9e2efed356079ba4f6b46a03d90a6c09b4 Mon Sep 17 00:00:00 2001 From: Marquee Date: Thu, 5 Feb 2015 22:11:22 -0500 Subject: [PATCH] Use Google Guava InetAddresses.forString() method to make sure we don't hit network. --- .../minecraft/redisbungee/DataManager.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java index 1c9527e..f096a99 100644 --- a/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java +++ b/src/main/java/com/imaginarycode/minecraft/redisbungee/DataManager.java @@ -6,6 +6,7 @@ */ package com.imaginarycode.minecraft.redisbungee; +import com.google.common.net.InetAddresses; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; @@ -24,7 +25,6 @@ import redis.clients.jedis.Jedis; import redis.clients.jedis.exceptions.JedisConnectionException; import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -122,11 +122,7 @@ public class DataManager implements Listener { try { String result = tmpRsc.hget("player:" + uuid, "ip"); if (result != null) { - address = InetAddress.getByName(result); - - if (address == null) - return null; - + address = InetAddresses.forString(result); ipCache.put(uuid, address); return address; } @@ -137,8 +133,6 @@ public class DataManager implements Listener { if (tmpRsc != null) plugin.getPool().returnBrokenResource(tmpRsc); throw new RuntimeException("Unable to get server for " + uuid, e); - } catch (UnknownHostException e) { - return null; } finally { plugin.getPool().returnResource(tmpRsc); }