This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new ecda61a  Add missing state check
ecda61a is described below

commit ecda61a54e6755263349a12607eff73e8f579aa8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Dec 3 17:46:01 2021 +0000

    Add missing state check
---
 .../org/apache/catalina/core/ApplicationSessionCookieConfig.java | 5 +++++
 webapps/docs/changelog.xml                                       | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java 
b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
index ae876f7..b83647e 100644
--- a/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
+++ b/java/org/apache/catalina/core/ApplicationSessionCookieConfig.java
@@ -168,6 +168,11 @@ public class ApplicationSessionCookieConfig implements 
SessionCookieConfig {
 
     @Override
     public void setAttribute(String name, String value) {
+        if (!context.getState().equals(LifecycleState.STARTING_PREP)) {
+            throw new IllegalStateException(sm.getString(
+                    "applicationSessionCookieConfig.ise", name,
+                    context.getPath()));
+        }
         attributes.put(name, value);
     }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5d231bf..9d578b3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,15 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.1.0-M9 (markt)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Add missing check in <code>SessionCookieConfig.setSttribute()</code> to
+        ensure that the method fails if called after the web application has
+        started. (markt)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 10.1.0-M8 (markt)" rtext="release in progress">
   <subsection name="Catalina">

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to