From 5ef9a1d24f04bf149791bc780999199889efa948 Mon Sep 17 00:00:00 2001 From: markt Date: Mon, 18 Jul 2011 16:18:54 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51503 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 | 6 ++++++ .../apache/catalina/connector/LocalStrings.properties | 1 + res/tomcat.nsi | 18 ++++++++++++++++++ webapps/docs/changelog.xml | 13 +++++++++++++ 4 files changed, 38 insertions(+) diff --git a/java/org/apache/catalina/connector/Connector.java b/java/org/apache/catalina/connector/Connector.java index e4e5c4e11..28cb5801c 100644 --- a/java/org/apache/catalina/connector/Connector.java +++ b/java/org/apache/catalina/connector/Connector.java @@ -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 { diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties index e0120808d..1449a4477 100644 --- a/java/org/apache/catalina/connector/LocalStrings.properties +++ b/java/org/apache/catalina/connector/LocalStrings.properties @@ -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 diff --git a/res/tomcat.nsi b/res/tomcat.nsi index 67c31a3b0..02bd14d57 100644 --- a/res/tomcat.nsi +++ b/res/tomcat.nsi @@ -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" diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index e39f182f9..cff432d57 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -70,6 +70,19 @@ Correctly handle a connectionTimeout value of -1 (no timeout) for the HTTP NIO and AJP NIO connectors. (markt) + + 51503: Add additional validation that prevents a connector + from starting if it does not have a port > 0. (markt) + + + + + + + 51503: 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) + -- 2.11.0