Fix play-mvc\methods NullPointerException (#12121)

This commit is contained in:
Shelby Huang 2024-08-29 04:48:45 +08:00 committed by GitHub
parent cdd8bbab5a
commit 3bcbacc8d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -79,6 +79,9 @@ public class MethodInstrumentation implements TypeInstrumentation {
@Advice.Local("otelScope") Scope scope,
@Advice.Return(typing = Assigner.Typing.DYNAMIC, readOnly = false) Object returnValue,
@Advice.Thrown Throwable throwable) {
if (scope == null) {
return;
}
scope.close();
returnValue =

View File

@ -71,6 +71,9 @@ public class ActionInstrumentation implements TypeInstrumentation {
@Advice.Return(readOnly = false) Future<Result> responseFuture,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
if (scope == null) {
return;
}
scope.close();
updateSpan(context, req);

View File

@ -71,6 +71,9 @@ public class ActionInstrumentation implements TypeInstrumentation {
@Advice.Return(readOnly = false) Future<Result> responseFuture,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
if (scope == null) {
return;
}
scope.close();
updateSpan(context, req);