This is an automated email from the ASF dual-hosted git repository.
dsoumis 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 c1d412741b Stabilize TestSwallowAbortedUploads.testChunkedPUTLimit
c1d412741b is described below
commit c1d412741bc3c2b208ce292ff2304aba118b4e69
Author: Dimitrios Soumis <[email protected]>
AuthorDate: Fri Sep 19 21:06:53 2025 +0300
Stabilize TestSwallowAbortedUploads.testChunkedPUTLimit
The test assumed write would fail once the server stopped swallowing, but
the client could finish buffering data before the close was observed, so no
SocketException was thrown during the write and the assertion failed.
---
.../apache/catalina/core/TestSwallowAbortedUploads.java | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
index 84dd60f1ee..7670b438cc 100644
--- a/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
+++ b/test/org/apache/catalina/core/TestSwallowAbortedUploads.java
@@ -23,6 +23,7 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.net.Socket;
+import java.net.SocketException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
@@ -423,7 +424,7 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
tomcat.start();
- Exception writeEx = null;
+ SocketException writeEx = null;
Exception readEx = null;
String responseLine = null;
@@ -442,7 +443,8 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
writer.write("10\r\n");
writer.write("0123456789ABCDEF\r\n");
}
- } catch (Exception e) {
+ writer.flush();
+ } catch (SocketException e) {
writeEx = e;
}
@@ -454,6 +456,17 @@ public class TestSwallowAbortedUploads extends
TomcatBaseTest {
} catch (IOException ioe) {
readEx = ioe;
}
+
+ // If no exception was thrown during the big write,
+ // write once more because the close may have not been observed
+ if (limit && writeEx == null) {
+ try {
+ writer.write("1\r\n");
+ writer.flush();
+ } catch (SocketException e) {
+ writeEx = e;
+ }
+ }
}
if (limit) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]