protected Validator createValidator() throws JspException {
final FacesContext facesContext = FacesContext.getCurrentInstance();
final Application application = facesContext.getApplication();
final FileItemValidator validator = (FileItemValidator) application.createValidator(FileItemValidator.VALIDATOR_ID);
final ELContext elContext = facesContext.getELContext();
if (maxSize != null) {
try {
validator.setMaxSize((Integer) maxSize.getValue(elContext));
} catch (final NumberFormatException e) {
LOG.warn(e.getMessage());
}
}
if (contentType != null) {
validator.setContentType(ComponentUtils.splitList((String) contentType.getValue(elContext)));
}
return validator;
}