* @throws Exception
*/
private void findAndExecuteValidationRule(PrintWriter writer, String validatorName,
String value, String type) throws Exception {
/* Look up the validator in the object registry. */
FieldValidator validator = lookupValidatorInRegistry(validatorName);
log.info("Found validator " + validator);
/* Convert the object if the type is specified. */
Object oValue = null;
if (type == null || "".equals(type.trim())) {
oValue = value;
} else {
oValue = convertIfNeeded(value, type);
}
/* Actually validated the field. */
ValidatorMessage message = (ValidatorMessage) validator.validate(oValue, "none");
if (!message.hasError()) {
log.info("VALID");
writer.print("valid");
} else {
log.info("NOT VALID");