This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 75e128ead3 Improve robustness
75e128ead3 is described below
commit 75e128ead3d39ef7293bbd8cc8274547c6413067
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 c216fe51c2..4ec27928ac 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -140,6 +140,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]