Fix NPE in servlet AsyncListener on OpenLiberty
Fixes
MODIFY
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java
instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java
@@ -69,6 +69,12 @@ public class ServletHttpAttributesGetter<REQUEST, RESPONSE>
@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

Fix NPE in servlet AsyncListener on OpenLiberty (#7498)

Fixes #7449