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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 37bdca36c6 Fix failing test.
37bdca36c6 is described below

commit 37bdca36c6c4275d0c87eb0d9aa412a7ca1c13c8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Dec 6 08:55:03 2023 +0000

    Fix failing test.
    
    NIO2 + Windows behaves slightly differently to NIO2 + Linux.
---
 test/org/apache/catalina/connector/TestClientReadTimeout.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test/org/apache/catalina/connector/TestClientReadTimeout.java 
b/test/org/apache/catalina/connector/TestClientReadTimeout.java
index 66a3334487..9342249ab0 100644
--- a/test/org/apache/catalina/connector/TestClientReadTimeout.java
+++ b/test/org/apache/catalina/connector/TestClientReadTimeout.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.Socket;
+import java.net.SocketException;
 import java.nio.charset.StandardCharsets;
 
 import javax.servlet.ServletException;
@@ -65,7 +66,12 @@ public class TestClientReadTimeout extends TomcatBaseTest {
             os.write(request.getBytes(StandardCharsets.UTF_8));
             InputStream is = socket.getInputStream();
             BufferedReader reader = new BufferedReader(new 
InputStreamReader(is, StandardCharsets.UTF_8));
-            String opening = reader.readLine();
+            String opening = null;
+            try {
+                opening = reader.readLine();
+            } catch (SocketException e) {
+                // Handled below. An exception here means opening will be null
+            }
             if 
(tomcat.getConnector().getProtocolHandlerClassName().contains("Nio2")) {
                 Assert.assertNull("NIO2 unexpectedly returned a response", 
opening);
             } else {


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

Reply via email to