use of java.util.EventListener in project tomcat by apache.
the class ApplicationContext method addListener.
@Override
public void addListener(String className) {
try {
if (context.getInstanceManager() != null) {
Object obj = context.getInstanceManager().newInstance(className);
if (!(obj instanceof EventListener)) {
throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.wrongType", className));
}
EventListener listener = (EventListener) obj;
addListener(listener);
}
} catch (InvocationTargetException e) {
ExceptionUtils.handleThrowable(e.getCause());
throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
} catch (ReflectiveOperationException | NamingException e) {
throw new IllegalArgumentException(sm.getString("applicationContext.addListener.iae.cnfe", className), e);
}
}
Aggregations