String currentDomain = spfData.getCurrentDomain();
if (currentDomain != null) {
String[] labels = currentDomain.split("\\.");
for (int i = 0; i < labels.length; i++) {
if (labels[i] != null && labels[i].length() > 63) {
throw new NoneException("Domain "+currentDomain+" is malformed (label longer than 63 characters)");
}
}
}
if (spfData.getSenderDomain().indexOf('.') < 0) {
throw new NoneException("Sender domain "+spfData.getSenderDomain()+" is not an FQDN.");
}
try {
Name.fromString(spfData.getSenderDomain());
} catch (TextParseException e) {
throw new NoneException("Invalid sender domain: "+e.getMessage());
}
}
return null;
}