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

remm 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 456c8c5c0a 69476: Catch possible ISE when reporting PUT failure
456c8c5c0a is described below

commit 456c8c5c0a5cb5ec1ff4f810706dac1b808580ad
Author: remm <r...@apache.org>
AuthorDate: Wed Nov 27 09:44:39 2024 +0100

    69476: Catch possible ISE when reporting PUT failure
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 6 +++++-
 webapps/docs/changelog.xml                            | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 7d90a48ca7..86286a3152 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -627,7 +627,11 @@ public class DefaultServlet extends HttpServlet {
                     resp.setStatus(HttpServletResponse.SC_CREATED);
                 }
             } else {
-                resp.sendError(HttpServletResponse.SC_CONFLICT);
+                try {
+                    resp.sendError(HttpServletResponse.SC_CONFLICT);
+                } catch (IllegalStateException e) {
+                    // Already committed, ignore
+                }
             }
         } finally {
             if (resourceInputStream != null) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6cbf70a5ec..1be5af4cb0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -179,6 +179,10 @@
         references to <code>application/x-www-form-urlencoded</code>. Based on
         pull request <pr>779</pr> by Chenjp. (markt)
       </add>
+      <fix>
+        <bug>69476</bug>: Catch possible ISE when trying to report PUT failure
+        in the <code>DefaultServlet</code>. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to