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

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 86325ea181 Improve robustness
86325ea181 is described below

commit 86325ea18151d383ec89f0710bd73b14999c4680
Author: remm <[email protected]>
AuthorDate: Wed May 20 17:34:15 2026 +0200

    Improve robustness
    
    Avoid a situation where a failed start leaves a broken pipeline in place
    while the code intent seemed to be the opposite.
---
 .../org/apache/catalina/core/StandardPipeline.java | 32 +++++++++++-----------
 webapps/docs/changelog.xml                         |  4 +++
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/java/org/apache/catalina/core/StandardPipeline.java 
b/java/org/apache/catalina/core/StandardPipeline.java
index f99ee35707..21c24efdb6 100644
--- a/java/org/apache/catalina/core/StandardPipeline.java
+++ b/java/org/apache/catalina/core/StandardPipeline.java
@@ -213,6 +213,22 @@ public class StandardPipeline extends LifecycleBase 
implements Pipeline {
             return;
         }
 
+        // Start the new component if necessary
+        if (valve == null) {
+            return;
+        }
+        if (valve instanceof Contained) {
+            ((Contained) valve).setContainer(this.container);
+        }
+        if (getState().isAvailable() && valve instanceof Lifecycle) {
+            try {
+                ((Lifecycle) valve).start();
+            } catch (LifecycleException e) {
+                log.error(sm.getString("standardPipeline.basic.start"), e);
+                return;
+            }
+        }
+
         // Stop the old component if necessary
         if (oldBasic != null) {
             if (getState().isAvailable() && (oldBasic instanceof Lifecycle)) {
@@ -231,22 +247,6 @@ public class StandardPipeline extends LifecycleBase 
implements Pipeline {
             }
         }
 
-        // Start the new component if necessary
-        if (valve == null) {
-            return;
-        }
-        if (valve instanceof Contained) {
-            ((Contained) valve).setContainer(this.container);
-        }
-        if (getState().isAvailable() && valve instanceof Lifecycle) {
-            try {
-                ((Lifecycle) valve).start();
-            } catch (LifecycleException e) {
-                log.error(sm.getString("standardPipeline.basic.start"), e);
-                return;
-            }
-        }
-
         // Update the pipeline
         Valve current = first;
         while (current != null) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d0fc2360a4..90d09a0887 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -132,6 +132,10 @@
       <fix>
         Incorrect session average life calculation. (remm)
       </fix>
+      <fix>
+        Improve robustness on using <code>Pipeline.setBasic</code> on a running
+        pipeline. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to