in resolver/src/main/java/org/apache/james/jspf/core/Inet6Util.java [395:430]
public static boolean isValidIPV4Address(String value) {
int periods = 0;
int i = 0;
int length = value.length();
if (length > 15)
return false;
char c = 0;
String word = "";
for (i = 0; i < length; i++) {
c = value.charAt(i);
if (c == '.') {
periods++;
if (periods > 3)
return false;
if (word == "")
return false;
if (Integer.parseInt(word) > 255)
return false;
word = "";
} else if (!(Character.isDigit(c)))
return false;
else {
if (word.length() > 2)
return false;
word += c;
}
}
if (word == "" || Integer.parseInt(word) > 255)
return false;
if (periods != 3)
return false;
return true;
}