From: markt Date: Sat, 24 Apr 2010 23:26:20 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49181 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0854f3c3e1e5d67b08ba5d973b7b51bdafffdb6c;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49181 Patch provided by Pid git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@937722 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index 2fbc24968..4d7518d9f 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -1256,24 +1256,29 @@ public class ApplicationContext // {@link ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)} // method of a {@link ServletContextListener} that was not declared // in web.xml, a web-fragment or annotated with {@link WebListener}. - + + boolean match = false; if (t instanceof ServletContextAttributeListener || t instanceof ServletRequestListener || t instanceof ServletRequestAttributeListener || t instanceof HttpSessionAttributeListener) { context.addApplicationEventListener(t); - return; + match = true; } if (t instanceof HttpSessionListener) { context.addApplicationLifecycleListener(t); + match = true; } if (t instanceof ServletContextListener) { // TODO SERVLET3 - also need to check caller? spec isn't clear context.addApplicationLifecycleListener(t); + match = true; } + if (match) return; + throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.wrongType", t.getClass().getName()));