You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2021/09/01 14:23:32 UTC

[felix-dev] branch master updated: FELIX-6434 : errorhandler can commit the response wice

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

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new abf81ce  FELIX-6434 : errorhandler can commit the response wice
abf81ce is described below

commit abf81ce9b54d5efae0abea8d84c668ab3bec86d2
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Sep 1 16:23:13 2021 +0200

    FELIX-6434 : errorhandler can commit the response wice
---
 .../felix/http/base/internal/dispatch/Dispatcher.java     | 15 ++++++++++++---
 http/bridge/pom.xml                                       |  2 +-
 http/itest/pom.xml                                        |  2 +-
 http/jetty/pom.xml                                        |  2 +-
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
index e3f7039..9c2fb35 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java
@@ -75,7 +75,10 @@ public final class Dispatcher
         if ( mgr == null )
         {
             // not active, always return 404
-            res.sendError(404);
+            if ( !res.isCommitted() ) 
+            {
+                res.sendError(404);
+            }
             return;
         }
 
@@ -123,7 +126,10 @@ public final class Dispatcher
 		        final HttpServletResponse wrappedResponse = new ServletResponseWrapper(req, res, servletName, errorRegistry);
 		        if ( pr == null )
 		        {
-		            wrappedResponse.sendError(404);
+                    if ( !wrappedResponse.isCommitted() ) 
+                    {
+                        wrappedResponse.sendError(404);
+                    }
 		            return;
 		        }
 
@@ -152,7 +158,10 @@ public final class Dispatcher
 		            req.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
 		            req.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE, e.getClass().getName());
 
-		            wrappedResponse.sendError(500);
+                    if ( !wrappedResponse.isCommitted() ) 
+                    {
+                        wrappedResponse.sendError(500);
+                    }
 		        }
 		        finally
 		        {
diff --git a/http/bridge/pom.xml b/http/bridge/pom.xml
index 7cacd4e..a50f214 100644
--- a/http/bridge/pom.xml
+++ b/http/bridge/pom.xml
@@ -141,7 +141,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>4.1.2</version>
+            <version>4.1.3-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
diff --git a/http/itest/pom.xml b/http/itest/pom.xml
index 667155c..e5374f7 100644
--- a/http/itest/pom.xml
+++ b/http/itest/pom.xml
@@ -35,7 +35,7 @@
         <pax.exam.version>4.13.1</pax.exam.version>
         <pax.url.aether.version>2.6.2</pax.url.aether.version>
         <http.servlet.api.version>1.1.2</http.servlet.api.version>
-        <http.jetty.version>4.1.9-SNAPSHOT</http.jetty.version>
+        <http.jetty.version>4.1.11-SNAPSHOT</http.jetty.version>
     </properties>
 
     <build>
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 7e35e17..77bf6e8 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -398,7 +398,7 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>4.1.2</version>
+            <version>4.1.3-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>commons-fileupload</groupId>