You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by jo...@apache.org on 2021/09/14 08:59:49 UTC
[sling-org-apache-sling-engine] 01/01: SLING-10810 do not set the
statuscode if the response is already committed
This is an automated email from the ASF dual-hosted git repository.
joerghoh pushed a commit to branch feature/SLING-10810-no-statuscode-update-when-already-committed
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-engine.git
commit ef0d652145becad2001db4886b75173d95e95331
Author: Joerg Hoh <jh...@adobe.com>
AuthorDate: Tue Sep 14 10:58:48 2021 +0200
SLING-10810 do not set the statuscode if the response is already committed
---
.../sling/engine/impl/SlingHttpServletResponseImpl.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java b/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
index 0ebcfba..8aaa917 100644
--- a/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
+++ b/src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java
@@ -150,11 +150,12 @@ public class SlingHttpServletResponseImpl extends HttpServletResponseWrapper imp
LOG.warn("Response already committed. Failed to set status code from {} to {}. {}",
getStatus(), sc, explanation);
}
- }
- if (msg == null) {
- super.setStatus(sc);
- } else {
- super.setStatus(sc, msg);
+ } else { // response is not yet committed, so the statuscode can be changed
+ if (msg == null) {
+ super.setStatus(sc);
+ } else {
+ super.setStatus(sc, msg);
+ }
}
}