You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/01/15 20:12:33 UTC

[tomcat] branch 9.0.x updated (581b30f -> c8c99bd)

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

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


    from 581b30f  Align master, 9.0.x and 8.5.x
     new 350f3cf  Use setProperty and test return value in preference to setAttribute
     new b9da643  pollerThreadCount does not exist for APR
     new c8c99bd  Deprecate pollerThreadCount

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/catalina/core/ApplicationContext.java   |  2 +-
 .../apache/coyote/http11/Http11NioProtocol.java    | 11 +++++++
 .../connector/TestCoyoteAdapterRequestFuzzing.java |  2 +-
 .../apache/catalina/core/TestAsyncContextImpl.java |  3 +-
 .../apache/catalina/core/TestStandardService.java  |  3 +-
 .../catalina/core/TestSwallowAbortedUploads.java   |  2 +-
 .../apache/catalina/startup/TomcatBaseTest.java    |  6 ++--
 .../apache/coyote/http11/TestHttp11Processor.java  | 34 +++++++++++-----------
 .../util/http/TestMimeHeadersIntegration.java      |  3 +-
 test/org/apache/tomcat/util/net/TesterSupport.java |  2 +-
 .../tomcat/websocket/TestConnectionLimit.java      |  3 +-
 11 files changed, 40 insertions(+), 31 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/03: Use setProperty and test return value in preference to setAttribute

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 350f3cf2106c88f6574998b1d3bc69edeaa1284b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 15 19:40:52 2020 +0000

    Use setProperty and test return value in preference to setAttribute
---
 .../apache/catalina/core/ApplicationContext.java   |  2 +-
 .../connector/TestCoyoteAdapterRequestFuzzing.java |  2 +-
 .../apache/catalina/core/TestAsyncContextImpl.java |  3 +-
 .../apache/catalina/core/TestStandardService.java  |  3 +-
 .../catalina/core/TestSwallowAbortedUploads.java   |  2 +-
 .../apache/catalina/startup/TomcatBaseTest.java    |  7 ++---
 .../apache/coyote/http11/TestHttp11Processor.java  | 34 +++++++++++-----------
 .../util/http/TestMimeHeadersIntegration.java      |  3 +-
 test/org/apache/tomcat/util/net/TesterSupport.java |  2 +-
 .../tomcat/websocket/TestConnectionLimit.java      |  3 +-
 10 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java
index 79628e0..b553b4c 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -1013,7 +1013,7 @@ public class ApplicationContext implements ServletContext {
         Connector[] connectors = service.findConnectors();
         // Need at least one SSL enabled connector to use the SSL session ID.
         for (Connector connector : connectors) {
-            if (Boolean.TRUE.equals(connector.getAttribute("SSLEnabled"))) {
+            if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) {
                 supportedSessionTrackingModes.add(SessionTrackingMode.SSL);
                 break;
             }
diff --git a/test/org/apache/catalina/connector/TestCoyoteAdapterRequestFuzzing.java b/test/org/apache/catalina/connector/TestCoyoteAdapterRequestFuzzing.java
index dc8ac5e..f2edf46 100644
--- a/test/org/apache/catalina/connector/TestCoyoteAdapterRequestFuzzing.java
+++ b/test/org/apache/catalina/connector/TestCoyoteAdapterRequestFuzzing.java
@@ -110,7 +110,7 @@ public class TestCoyoteAdapterRequestFuzzing extends TomcatBaseTest {
     @Test
     public void doTest() throws Exception {
         Tomcat tomcat = getTomcatInstance();
-        tomcat.getConnector().setAttribute("restrictedUserAgents", "value-not-important");
+        Assert.assertTrue(tomcat.getConnector().setProperty("restrictedUserAgents", "value-not-important"));
 
         File appDir = new File("test/webapp");
         Context ctxt = tomcat.addContext("", appDir.getAbsolutePath());
diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java b/test/org/apache/catalina/core/TestAsyncContextImpl.java
index ea156ba..e4a9b63 100644
--- a/test/org/apache/catalina/core/TestAsyncContextImpl.java
+++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java
@@ -171,8 +171,7 @@ public class TestAsyncContextImpl extends TomcatBaseTest {
         Tomcat tomcat = getTomcatInstance();
 
         // Minimise pauses during test
-        tomcat.getConnector().setAttribute(
-                "connectionTimeout", Integer.valueOf(3000));
+        Assert.assertTrue(tomcat.getConnector().setProperty("connectionTimeout", "3000"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
diff --git a/test/org/apache/catalina/core/TestStandardService.java b/test/org/apache/catalina/core/TestStandardService.java
index 0ec93ce..ba1e954 100644
--- a/test/org/apache/catalina/core/TestStandardService.java
+++ b/test/org/apache/catalina/core/TestStandardService.java
@@ -18,6 +18,7 @@ package org.apache.catalina.core;
 
 import java.net.InetAddress;
 
+import org.junit.Assert;
 import org.junit.Test;
 
 import org.apache.catalina.connector.Connector;
@@ -49,7 +50,7 @@ public class TestStandardService extends TomcatBaseTest {
         Connector c2 = new Connector("HTTP/1.1");
         c2.setThrowOnFailure(throwOnFailure);
 
-        c2.setAttribute("address", ((InetAddress) connector.getAttribute("address")).getHostAddress());
+        Assert.assertTrue(c2.setProperty("address", ((InetAddress) connector.getProperty("address")).getHostAddress()));
         c2.setPort(connector.getLocalPort());
 
         tomcat.getService().addConnector(c2);
diff --git a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
index 72e3a7b..83b1634 100644
--- a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
+++ b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
@@ -431,7 +431,7 @@ public class TestSwallowAbortedUploads extends TomcatBaseTest {
         // No need for target to exist.
 
         if (!limit) {
-            tomcat.getConnector().setAttribute("maxSwallowSize", "-1");
+            Assert.assertTrue(tomcat.getConnector().setProperty("maxSwallowSize", "-1"));
         }
 
         tomcat.start();
diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java b/test/org/apache/catalina/startup/TomcatBaseTest.java
index ac7c3f5..75e588d 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -170,12 +170,11 @@ public abstract class TomcatBaseTest extends LoggingBaseTest {
         String protocol = getProtocol();
         Connector connector = new Connector(protocol);
         // Listen only on localhost
-        connector.setAttribute("address",
-                InetAddress.getByName("localhost").getHostAddress());
+        Assert.assertTrue(connector.setProperty("address", InetAddress.getByName("localhost").getHostAddress()));
         // Use random free port
         connector.setPort(0);
         // Mainly set to reduce timeouts during async tests
-        connector.setAttribute("connectionTimeout", "3000");
+        Assert.assertTrue(connector.setProperty("connectionTimeout", "3000"));
         tomcat.getService().addConnector(connector);
         tomcat.setConnector(connector);
 
@@ -185,7 +184,7 @@ public abstract class TomcatBaseTest extends LoggingBaseTest {
             AprLifecycleListener listener = new AprLifecycleListener();
             listener.setSSLRandomSeed("/dev/urandom");
             server.addLifecycleListener(listener);
-            connector.setAttribute("pollerThreadCount", Integer.valueOf(1));
+            Assert.assertTrue(connector.setProperty("pollerThreadCount", "1"));
         }
 
         File catalinaBase = getTemporaryDirectory();
diff --git a/test/org/apache/coyote/http11/TestHttp11Processor.java b/test/org/apache/coyote/http11/TestHttp11Processor.java
index ce17ca4..f7f5f74 100644
--- a/test/org/apache/coyote/http11/TestHttp11Processor.java
+++ b/test/org/apache/coyote/http11/TestHttp11Processor.java
@@ -68,7 +68,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1020,7 +1020,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1056,7 +1056,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1089,7 +1089,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1120,7 +1120,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1152,7 +1152,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1184,7 +1184,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1221,7 +1221,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1258,7 +1258,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1295,7 +1295,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1331,7 +1331,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1367,7 +1367,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1405,7 +1405,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1443,7 +1443,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1482,7 +1482,7 @@ public class TestHttp11Processor extends TomcatBaseTest {
 
         // This setting means the connection will be closed at the end of the
         // request
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", "1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxKeepAliveRequests", "1"));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
@@ -1544,8 +1544,8 @@ public class TestHttp11Processor extends TomcatBaseTest {
             int maxKeepAliveRequests) throws Exception {
         Tomcat tomcat = getTomcatInstance();
 
-        tomcat.getConnector().setAttribute("keepAliveTimeout", Integer.valueOf(keepAliveTimeout));
-        tomcat.getConnector().setAttribute("maxKeepAliveRequests", Integer.valueOf(maxKeepAliveRequests));
+        tomcat.getConnector().setProperty("keepAliveTimeout", Integer.toString(keepAliveTimeout));
+        tomcat.getConnector().setProperty("maxKeepAliveRequests", Integer.toString(maxKeepAliveRequests));
 
         // No file system docBase required
         Context ctx = tomcat.addContext("", null);
diff --git a/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java b/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java
index 93ddab3..b697dd7 100644
--- a/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java
+++ b/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java
@@ -105,8 +105,7 @@ public class TestMimeHeadersIntegration extends TomcatBaseTest {
         if (maxHeaderCount > 0) {
             Assert.assertEquals(maxHeaderCount, alv.arraySize);
         } else if (maxHeaderCount < 0) {
-            int maxHttpHeaderSize = ((Integer) tomcat.getConnector()
-                    .getAttribute("maxHttpHeaderSize")).intValue();
+            int maxHttpHeaderSize = ((Integer) tomcat.getConnector().getProperty("maxHttpHeaderSize")).intValue();
             int headerCount = Math.min(count,
                     maxHttpHeaderSize / header.length() + 1);
             int arraySize = 1;
diff --git a/test/org/apache/tomcat/util/net/TesterSupport.java b/test/org/apache/tomcat/util/net/TesterSupport.java
index 02d7866..842e80c 100644
--- a/test/org/apache/tomcat/util/net/TesterSupport.java
+++ b/test/org/apache/tomcat/util/net/TesterSupport.java
@@ -154,7 +154,7 @@ public final class TesterSupport {
                 AprLifecycleListener listener = new AprLifecycleListener();
                 listener.setSSLRandomSeed("/dev/urandom");
                 server.addLifecycleListener(listener);
-                connector.setAttribute("sslImplementationName", sslImplementation);
+                Assert.assertTrue(connector.setProperty("sslImplementationName", sslImplementation));
             }
             sslHostConfig.setSslProtocol("tls");
             certificate.setCertificateKeystoreFile(new File(keystore).getAbsolutePath());
diff --git a/test/org/apache/tomcat/websocket/TestConnectionLimit.java b/test/org/apache/tomcat/websocket/TestConnectionLimit.java
index 85c2a0f..5d966e2 100644
--- a/test/org/apache/tomcat/websocket/TestConnectionLimit.java
+++ b/test/org/apache/tomcat/websocket/TestConnectionLimit.java
@@ -25,6 +25,7 @@ import javax.websocket.ContainerProvider;
 import javax.websocket.DeploymentException;
 import javax.websocket.WebSocketContainer;
 
+import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -50,7 +51,7 @@ public class TestConnectionLimit extends TomcatBaseTest {
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMappingDecoded("/", "default");
 
-        tomcat.getConnector().setAttribute("maxConnections", "-1");
+        Assert.assertTrue(tomcat.getConnector().setProperty("maxConnections", "-1"));
 
         tomcat.start();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 03/03: Deprecate pollerThreadCount

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c8c99bd2e57c4804b3bdb667d7b4e5f4ccb28640
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 15 19:44:54 2020 +0000

    Deprecate pollerThreadCount
---
 java/org/apache/coyote/http11/Http11NioProtocol.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/java/org/apache/coyote/http11/Http11NioProtocol.java b/java/org/apache/coyote/http11/Http11NioProtocol.java
index 92c278c..43327f3 100644
--- a/java/org/apache/coyote/http11/Http11NioProtocol.java
+++ b/java/org/apache/coyote/http11/Http11NioProtocol.java
@@ -50,10 +50,21 @@ public class Http11NioProtocol extends AbstractHttp11JsseProtocol<NioChannel> {
      * NO-OP.
      *
      * @param count Unused
+     *
+     * @deprecated This setter will be removed in Tomcat 10.
      */
+    @Deprecated
     public void setPollerThreadCount(int count) {
     }
 
+    /**
+     * Always returns 1.
+     *
+     * @return 1
+     *
+     * @deprecated This getter will be removed in Tomcat 10.
+     */
+    @Deprecated
     public int getPollerThreadCount() {
         return 1;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/03: pollerThreadCount does not exist for APR

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b9da6430b0f8e4bbcfc2ca98779b90f697a26933
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jan 15 19:42:44 2020 +0000

    pollerThreadCount does not exist for APR
---
 test/org/apache/catalina/startup/TomcatBaseTest.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/test/org/apache/catalina/startup/TomcatBaseTest.java b/test/org/apache/catalina/startup/TomcatBaseTest.java
index 75e588d..d3cdc2e 100644
--- a/test/org/apache/catalina/startup/TomcatBaseTest.java
+++ b/test/org/apache/catalina/startup/TomcatBaseTest.java
@@ -184,7 +184,6 @@ public abstract class TomcatBaseTest extends LoggingBaseTest {
             AprLifecycleListener listener = new AprLifecycleListener();
             listener.setSSLRandomSeed("/dev/urandom");
             server.addLifecycleListener(listener);
-            Assert.assertTrue(connector.setProperty("pollerThreadCount", "1"));
         }
 
         File catalinaBase = getTemporaryDirectory();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org