raducotescu commented on code in PR #62:
URL: 
https://github.com/apache/sling-org-apache-sling-engine/pull/62#discussion_r2108526466


##########
src/main/java/org/apache/sling/engine/impl/filter/ErrorFilterChain.java:
##########
@@ -118,6 +121,10 @@ public void doFilter(final ServletRequest request, final 
ServletResponse respons
                 return;
             }
             // reset the response to clear headers and body
+            if (response instanceof SlingHttpServletResponseImpl) {
+                final DispatchingInfo dispatchInfo = new 
DispatchingInfo(DispatcherType.ERROR);
+                ((SlingHttpServletResponseImpl) 
response).getRequestData().setDispatchingInfo(dispatchInfo);
+            }

Review Comment:
   Why don't you reuse the existing `DispachingInfo`? I would expose a setter 
in it for the `DispatcherType`, call it and then reset.



##########
src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java:
##########
@@ -220,12 +225,12 @@ public void setStatus(final int sc, final String msg) {
 
     @Override
     public void reset() {
-        if (!this.isProtectHeadersOnInclude()) {
+        if (!this.isProtectHeadersOnInclude() || isError()) {
             super.reset();
         } else {
             // ignore if not committed
-            if (getResponse().isCommitted()) {
-                getResponse().reset();
+            if (super.isCommitted()) {
+                super.reset();

Review Comment:
   The code did and still does something else than the comment says:
   ```suggestion
               if (!isCommitted()) {
                   super.reset();
   ```



##########
src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java:
##########
@@ -325,7 +330,7 @@ private String getCurrentStackTrace() {
 
     @Override
     public void setContentType(final String type) {
-        if (super.getResponse().isCommitted() || !isInclude()) {
+        if (super.isCommitted() || !isInclude()) {

Review Comment:
   ```suggestion
           if (!isCommitted() || !isInclude()) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to