public void validate(FacesContext context,
UIComponent component,
Object value) throws ValidatorException {
if ((context == null) || (component == null)) {
throw new NullPointerException();
}
if (value != null) {
try {
ELContext elContext = context.getELContext();
methodExpression.invoke(elContext, new Object[]{context, component, value});
} catch (ELException ee) {
Throwable e = ee.getCause();
if (e instanceof ValidatorException) {
throw (ValidatorException) e;
}
String errInfo = ee.getMessage();
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
errInfo,
errInfo);
throw new ValidatorException(message, ee.getCause());
}
}
}
|