You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "EarthChen (via GitHub)" <gi...@apache.org> on 2023/03/09 09:24:27 UTC

[GitHub] [dubbo] EarthChen commented on a diff in pull request #11770: Fix bug #11760

EarthChen commented on code in PR #11770:
URL: https://github.com/apache/dubbo/pull/11770#discussion_r1130706142


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/BiStreamServerCallListener.java:
##########
@@ -27,24 +27,32 @@ public class BiStreamServerCallListener extends AbstractServerCallListener {
 
     private StreamObserver<Object> requestObserver;
 
-    public BiStreamServerCallListener(RpcInvocation invocation, Invoker<?> invoker,
-        ServerCallToObserverAdapter<Object> responseObserver) {
+    public BiStreamServerCallListener(RpcInvocation invocation,
+                                      Invoker<?> invoker,
+                                      ServerCallToObserverAdapter<Object> responseObserver) {
         super(invocation, invoker, responseObserver);
         invocation.setArguments(new Object[]{responseObserver});
         invoke();
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public void onReturn(Object value) {
-        this.requestObserver = (StreamObserver<Object>) value;
+        if (value instanceof Throwable) {
+            responseObserver.onError((Throwable) value);
+        } else if (value instanceof StreamObserver) {
+            this.requestObserver = (StreamObserver<Object>) value;
+        }
     }
 
     @Override
     public void onMessage(Object message) {
         if (message instanceof Object[]) {
             message = ((Object[]) message)[0];
         }
-        requestObserver.onNext(message);
+        if (requestObserver != null) {

Review Comment:
   Making a null judgment here doesn't seem to solve the underlying problem



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org