This is an automated email from the ASF dual-hosted git repository.
markt-asf 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 3934a54b20 Clean-up error handling in tests
3934a54b20 is described below
commit 3934a54b2016eb7dbb3d8652e4d1f4edb24fca7a
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Jun 5 19:24:14 2026 +0100
Clean-up error handling in tests
---
.../http11/filters/TestChunkedInputFilter.java | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
index 48637d0fb8..c8cb65141b 100644
--- a/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
+++ b/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java
@@ -160,7 +160,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
Assert.assertFalse(servlet.getExceptionDuringRead());
} else {
if (processException == null) {
- Assert.assertTrue(client.getResponseLine(),
client.isResponse500());
+ Assert.assertTrue(client.getResponseLine(),
client.isResponse400());
} else {
// Use fall-back for checking the error occurred
Assert.assertTrue(servlet.getExceptionDuringRead());
@@ -213,7 +213,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
Assert.assertEquals(7, servlet.getCountRead());
Assert.assertTrue(servlet.getExceptionDuringRead());
if (processException == null) {
- Assert.assertTrue(client.getResponseLine(),
client.isResponse500());
+ Assert.assertTrue(client.getResponseLine(),
client.isResponse400());
}
}
@@ -323,7 +323,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
if (pass) {
Assert.assertTrue(client.isResponse200());
} else {
- Assert.assertTrue(client.isResponse500());
+ Assert.assertTrue(client.isResponse400());
}
}
@@ -423,7 +423,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
if (ok) {
Assert.assertTrue(client.getResponseLine(),
client.isResponse200());
} else {
- Assert.assertTrue(client.getResponseLine(),
client.isResponse500());
+ Assert.assertTrue(client.getResponseLine(),
client.isResponse400());
}
}
@@ -584,7 +584,7 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
Assert.assertEquals(expectReadCount, servlet.getCountRead());
} else {
if (processException == null) {
- Assert.assertTrue(client.getResponseLine(),
client.isResponse500());
+ Assert.assertTrue(client.getResponseLine(),
client.isResponse400());
}
Assert.assertEquals(0, servlet.getCountRead());
Assert.assertTrue(servlet.getExceptionDuringRead());
@@ -715,7 +715,9 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
exceptionDuringRead = true;
if (!expectPass) { // as expected
log(ioe.toString());
-
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ if (!resp.isCommitted()) {
+
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
return;
}
throw ioe;
@@ -771,7 +773,9 @@ public class TestChunkedInputFilter extends TomcatBaseTest {
exceptionDuringRead = true;
if (!expectPass) { // as expected
log(ioe.toString());
-
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ if (!resp.isCommitted()) {
+
resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
return;
}
throw ioe;
@@ -1215,7 +1219,7 @@ public class TestChunkedInputFilter extends
TomcatBaseTest {
if (ok) {
Assert.assertTrue(client.isResponse200());
} else {
- Assert.assertTrue(client.isResponse500());
+ Assert.assertTrue(client.isResponse400());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]