Skip to content

Commit

Permalink
Fix NPE in servlet AsyncListener on OpenLiberty (#7498)
Browse files Browse the repository at this point in the history
Fixes #7449
  • Loading branch information
Mateusz Rzeszutek authored Jan 3, 2023
1 parent 64bef1c commit d4d623d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public Integer statusCode(
@Nullable Throwable error) {
RESPONSE response = responseContext.response();

// OpenLiberty might call the AsyncListener with an AsyncEvent that does not contain a response
// in some cases where the connection is dropped
if (response == null) {
return null;
}

if (!accessor.isResponseCommitted(response) && error != null) {
// if response is not committed and there is a throwable set status to 500 /
// INTERNAL_SERVER_ERROR, due to servlet spec
Expand Down

0 comments on commit d4d623d

Please sign in to comment.