You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/03/06 17:21:11 UTC
svn commit: r1574944 - in /tomcat/tc7.0.x/trunk: ./
java/org/apache/catalina/core/ApplicationContext.java
java/org/apache/catalina/core/LocalStrings.properties
test/org/apache/catalina/core/TestApplicationContext.java
webapps/docs/changelog.xml
Author: markt
Date: Thu Mar 6 16:21:11 2014
New Revision: 1574944
URL: http://svn.apache.org/r1574944
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56223
Throw an IllegalStateException if a call is made to ServletContext.setInitParameter() after the ServletContext has been initialized
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1574943
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1574944&r1=1574943&r2=1574944&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Thu Mar 6 16:21:11 2014
@@ -1280,6 +1280,12 @@ public class ApplicationContext
@Override
public boolean setInitParameter(String name, String value) {
+ if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
+ throw new IllegalStateException(
+ sm.getString("applicationContext.setInitParam.ise",
+ getContextPath()));
+ }
+
return parameters.putIfAbsent(name, value) == null;
}
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties?rev=1574944&r1=1574943&r2=1574944&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/LocalStrings.properties Thu Mar 6 16:21:11 2014
@@ -30,6 +30,7 @@ applicationContext.role.iae=An individua
applicationContext.roles.iae=Array of roles to declare for context [{0}] cannot be null
applicationContext.setAttribute.namenull=Name cannot be null
applicationContext.addSessionCookieConfig.ise=Session Cookie configuration cannot be set for context {0} as the context has been initialised
+applicationContext.setInitParam.ise=Initialization parameters can not be set after the context has been initialized
applicationContext.setSessionTracking.ise=The session tracking modes for context {0} cannot be set whilst the context is running
applicationContext.setSessionTracking.iae.invalid=The session tracking mode {0} requested for context {1} is not supported by that context
applicationContext.setSessionTracking.iae.ssl=The session tracking modes requested for context {0} included SSL and at least one other mode. SSL may not be configured with other modes.
Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java?rev=1574944&r1=1574943&r2=1574944&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/core/TestApplicationContext.java Thu Mar 6 16:21:11 2014
@@ -127,4 +127,11 @@ public class TestApplicationContext exte
return standardContext.getServletContext();
}
+
+
+ @Test(expected = IllegalStateException.class)
+ public void testSetInitParameter() throws Exception {
+ getTomcatInstance().start();
+ getServletContext().setInitParameter("name", "value");
+ }
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1574944&r1=1574943&r2=1574944&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Mar 6 16:21:11 2014
@@ -102,6 +102,11 @@
validation of web.xml files when Jasper parses them and validateTld
controls the validation of *.tld files when Jasper parses them. (markt)
</fix>
+ <fix>
+ <bug>56223</bug>: Throw an <code>IllegalStateException</code> if a call
+ is made to <code>ServletContext.setInitParameter()</code> after the
+ ServletContext has been initialized. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org