Skip to content

Commit

Permalink
Add API that allows the error status for the response to be reset
Browse files Browse the repository at this point in the history
This is required to fix an issue with async where a dispatch after an
error is still flagged as an error which causes the dispatch to be
skipped.
  • Loading branch information
markt-asf committed Apr 18, 2024
1 parent 9328072 commit 21837ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions java/org/apache/catalina/connector/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ public boolean setErrorReported() {
}


public void resetError() {
getCoyoteResponse().resetError();
}


/**
* Perform whatever actions are required to flush and close the output stream or writer, in a single operation.
*
Expand Down
7 changes: 6 additions & 1 deletion java/org/apache/coyote/Response.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ public boolean setErrorReported() {
}


public void resetError() {
errorState.set(0);
}


// -------------------- Methods --------------------

public void reset() throws IllegalStateException {
Expand Down Expand Up @@ -656,7 +661,7 @@ public void recycle() {
committed = false;
commitTimeNanos = -1;
errorException = null;
errorState.set(0);
resetError();
headers.recycle();
trailerFieldsSupplier = null;
// Servlet 3.1 non-blocking write listener
Expand Down

0 comments on commit 21837ba

Please sign in to comment.