Add ip validation exclusion for IPv6 localhost ip (Ariel's testing server)

This commit is contained in:
Colin McDonald 2016-07-25 20:59:34 -04:00
parent 4b0d66985e
commit 1c64109862
1 changed files with 10 additions and 1 deletions

View File

@ -14,7 +14,16 @@ public class IpUtils {
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])$");
public static boolean isValidIp(String ip) {
return ip != null && VALID_IP_PATTERN.matcher(ip).matches();
if (ip == null) {
return false;
}
// :(
if (ip.equals("::1")) {
return true;
} else {
return VALID_IP_PATTERN.matcher(ip).matches();
}
}
}