This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new bcfa1112a7 Stabilize TestSwallowAbortedUploads.testChunkedPUTLimit
bcfa1112a7 is described below
commit bcfa1112a74a89ad12f310b6985485e8e5389161
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 8b5f45a073..aea3986e0a 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]