Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51503
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 18 Jul 2011 16:18:54 +0000 (16:18 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 18 Jul 2011 16:18:54 +0000 (16:18 +0000)
Add additional validation to Windows installer and Tomcat start for connector port numbers

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

java/org/apache/catalina/connector/Connector.java
java/org/apache/catalina/connector/LocalStrings.properties
res/tomcat.nsi
webapps/docs/changelog.xml

index e4e5c4e..28cb580 100644 (file)
@@ -927,6 +927,12 @@ public class Connector extends LifecycleMBeanBase  {
     @Override
     protected void startInternal() throws LifecycleException {
 
+        // Validate settings before starting
+        if (getPort() < 1) {
+            throw new LifecycleException(sm.getString(
+                    "coyoteConnector.invalidPort", Integer.valueOf(getPort())));
+        }
+
         setState(LifecycleState.STARTING);
 
         try {
index e012080..1449a44 100644 (file)
@@ -18,6 +18,7 @@
 # CoyoteConnector
 #
 coyoteConnector.cannotRegisterProtocol=Cannot register MBean for the Protocol
+coyoteConnector.invalidPort=The connector cannot start since the specified port value of [{0}] is invalid
 coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed
 coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization failed
 coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation failed
index 67c31a3..02bd14d 100644 (file)
@@ -549,6 +549,24 @@ Function pageConfigurationLeave
     ${NSD_GetText} $CtlTomcatAdminRoles $TomcatAdminRoles
   ${EndIf}
 
+  ${If} $TomcatPortShutdown == ""
+    MessageBox MB_ICONEXCLAMATION|MB_OK 'The shutdown port may not be empty'
+    Abort "Config not right"
+    Goto exit
+  ${EndIf}
+
+  ${If} $TomcatPortHttp == ""
+    MessageBox MB_ICONEXCLAMATION|MB_OK 'The HTTP port may not be empty'
+    Abort "Config not right"
+    Goto exit
+  ${EndIf}
+
+  ${If} $TomcatPortAjp == ""
+    MessageBox MB_ICONEXCLAMATION|MB_OK 'The AJP port may not be empty'
+    Abort "Config not right"
+    Goto exit
+  ${EndIf}
+
   ${If} $TomcatServiceName == ""
     MessageBox MB_ICONEXCLAMATION|MB_OK 'The Service Name may not be empty'
     Abort "Config not right"
index e39f182..cff432d 100644 (file)
         Correctly handle a connectionTimeout value of -1 (no timeout) for the
         HTTP NIO and AJP NIO connectors. (markt)
       </fix>
+      <fix>
+        <bug>51503</bug>: Add additional validation that prevents a connector
+        from starting if it does not have a port > 0. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+  <subsection>
+    <changelog>
+      <fix>
+        <bug>51503</bug>: Add additional validation to Windows installer that
+        ensure that the shutdown port, HTTP port and AJP port are all specified
+        during the install process. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>