This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new b74778f  fix: fix spring gateway plugin npe (#7389)
b74778f is described below

commit b74778f0f44e590c9b06e121b3131d985d750e90
Author: wallezhang <[email protected]>
AuthorDate: Thu Jul 29 21:08:27 2021 +0800

    fix: fix spring gateway plugin npe (#7389)
---
 CHANGES.md                                               |  1 +
 .../v5/webclient/WebFluxWebClientInterceptor.java        | 16 ++++++----------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index c172f6f..2febc11 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -41,6 +41,7 @@ Release Notes.
 * Remove the logic of generating instance name in 
`KafkaServiceManagementServiceClient` class.
 * Improve `okhttp` plugin performance by optimizing Class.getDeclaredField().
 * Fix `GRPCLogClientAppender` no context warning.
+* Fix `spring-webflux-5.x-webclient-plugin` NPE.
 
 #### OAP-Backend
 
diff --git 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-webflux-5.x-webclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/webclient/WebFluxWebClientInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-webflux-5.x-webclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/webclient/WebFluxWebClientInterceptor.java
index bb88bc1..a32272f 100644
--- 
a/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-webflux-5.x-webclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/webclient/WebFluxWebClientInterceptor.java
+++ 
b/apm-sniffer/apm-sdk-plugin/spring-plugins/spring-webflux-5.x-webclient-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/webflux/v5/webclient/WebFluxWebClientInterceptor.java
@@ -34,7 +34,6 @@ import reactor.core.publisher.Mono;
 
 import java.lang.reflect.Method;
 import java.net.URI;
-import java.util.function.BiConsumer;
 
 public class WebFluxWebClientInterceptor implements 
InstanceMethodsAroundInterceptorV2 {
 
@@ -79,15 +78,12 @@ public class WebFluxWebClientInterceptor implements 
InstanceMethodsAroundInterce
         }
         Mono<ClientResponse> ret1 = (Mono<ClientResponse>) ret;
         AbstractSpan span = (AbstractSpan) context.getContext();
-        return ret1.doAfterSuccessOrError(new BiConsumer<ClientResponse, 
Throwable>() {
-            @Override
-            public void accept(ClientResponse clientResponse, Throwable 
throwable) {
-                HttpStatus httpStatus = clientResponse.statusCode();
-                if (httpStatus != null) {
-                    Tags.STATUS_CODE.set(span, 
Integer.toString(httpStatus.value()));
-                    if (httpStatus.isError()) {
-                        span.errorOccurred();
-                    }
+        return ret1.doOnSuccess(clientResponse -> {
+            HttpStatus httpStatus = clientResponse.statusCode();
+            if (httpStatus != null) {
+                Tags.STATUS_CODE.set(span, 
Integer.toString(httpStatus.value()));
+                if (httpStatus.isError()) {
+                    span.errorOccurred();
                 }
             }
         }).doOnError(error -> {

Reply via email to