Fix comment typo
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 Oct 2010 21:47:27 +0000 (21:47 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 6 Oct 2010 21:47:27 +0000 (21:47 +0000)
Better error message when a SCL can not be added since the listeners have already been called.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1005266 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ApplicationContext.java

index 391bad0..c216d49 100644 (file)
@@ -206,7 +206,7 @@ public class ApplicationContext
     /**
      * Flag that indicates if a new {@link ServletContextListener} may be added
      * to the application. Once the first {@link ServletContextListener} is
-     * called, not more may be added.
+     * called, no more may be added.
      */
     private boolean newServletContextListenerAllowed = true;
 
@@ -1312,10 +1312,15 @@ public class ApplicationContext
         
         if (match) return;
         
-        throw new IllegalArgumentException(sm.getString(
-                "applicationContext.addListener.iae.wrongType",
-                t.getClass().getName()));
-
+        if (t instanceof ServletContextListener) {
+            throw new IllegalArgumentException(sm.getString(
+                    "applicationContext.addListener.iae.sclNotAllowed",
+                    t.getClass().getName()));
+        } else {
+            throw new IllegalArgumentException(sm.getString(
+                    "applicationContext.addListener.iae.wrongType",
+                    t.getClass().getName()));
+        }
     }