Remainder of fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=49372
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Jun 2010 21:51:30 +0000 (21:51 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 6 Jun 2010 21:51:30 +0000 (21:51 +0000)
Avoid invalid Lifecycle transitions on failed start due to already bound shutdown port

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

java/org/apache/catalina/core/StandardService.java

index af346eb..9f14466 100644 (file)
@@ -479,7 +479,12 @@ public class StandardService extends LifecycleMBeanBase implements Service {
         // Stop our defined Connectors first
         synchronized (connectors) {
             for (int i = 0; i < connectors.length; i++) {
-                ((Lifecycle) connectors[i]).stop();
+                // If Service fails to start, connectors may not have been
+                // started
+                if (!LifecycleState.INITIALIZED.equals(
+                        ((Lifecycle) connectors[i]).getState())) {
+                    ((Lifecycle) connectors[i]).stop();
+                }
             }
         }