Class<?> clazz = loader.loadClass(className);
validator = (PreferencesValidator) clazz.newInstance();
cache.put(portletDD, validator);
} catch (InstantiationException ex) {
LOG.error("Error instantiating validator.", ex);
throw new ValidatorException(ex, null);
} catch (IllegalAccessException ex) {
LOG.error("Error instantiating validator.", ex);
throw new ValidatorException(ex, null);
} catch (ClassNotFoundException ex) {
LOG.error("Error instantiating validator.", ex);
throw new ValidatorException(ex, null);
} catch (ClassCastException ex) {
LOG.error("Error casting instance to PreferencesValidator.", ex);
throw new ValidatorException(ex, null);
}
}
}
return validator;
}