return (Validator) validators.get(selected);
}
public String execute() throws Exception {
loadValidators();
Validator validator = getSelectedValidator();
properties = new TreeSet();
try {
Map context = Ognl.createDefaultContext(validator);
BeanInfo beanInfoFrom = null;
try {
beanInfoFrom = Introspector.getBeanInfo(validator.getClass(), Object.class);
} catch (IntrospectionException e) {
log.error("An error occurred", e);
addActionError("An error occurred while introspecting a validator of type " + validator.getClass().getName());
return ERROR;
}
PropertyDescriptor[] pds = beanInfoFrom.getPropertyDescriptors();
for (int i = 0; i < pds.length; i++) {
PropertyDescriptor pd = pds[i];
String name = pd.getName();
Object value = null;
if (pd.getReadMethod() == null) {
value = "No read method for property";
} else {
try {
Object expr = OgnlUtil.compile(name);
value = Ognl.getValue(expr, context, validator);
} catch (OgnlException e) {
addActionError("Caught OGNL exception while getting property value for '" + name + "' on validator of type " + validator.getClass().getName());
}
}
properties.add(new PropertyInfo(name, pd.getPropertyType(), value));
}
} catch (Exception e) {