@Override
protected List<ValidationMessage> validate(List<ValidationMessage> messages) {
messages = super.validate(messages);
if (mime == null || mime.length() == 0)
messages = addValidationMessage(messages, new ValidationMessage("mime", "haystack.required"));
else if (mime.indexOf('/') < 0)
messages = addValidationMessage(messages, new ValidationMessage("mime", "haystack.invalidValue"));
else {
for (int i = 0; i < mime.length(); ++i) {
int c = mime.charAt(i);
if (c > 127 || c == ')') {
messages = addValidationMessage(messages, new ValidationMessage("mime", "haystack.invalidChar",
new Object[] { new Character((char) c) }));
break;
}
}
}