You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by gu...@apache.org on 2021/09/06 07:27:39 UTC
[dubbo] branch 3.0 updated: Fix client can not recognize trailers
only (#8664)
This is an automated email from the ASF dual-hosted git repository.
guohao pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new b941767 Fix client can not recognize trailers only (#8664)
b941767 is described below
commit b9417673ef52d1206bfae277a1017793023a2a74
Author: GuoHao <gu...@gmail.com>
AuthorDate: Mon Sep 6 15:27:24 2021 +0800
Fix client can not recognize trailers only (#8664)
---
.../java/org/apache/dubbo/rpc/protocol/tri/UnaryClientStream.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryClientStream.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryClientStream.java
index a9d4ce8..3f4c782 100644
--- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryClientStream.java
+++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/UnaryClientStream.java
@@ -78,8 +78,9 @@ public class UnaryClientStream extends AbstractClientStream implements Stream {
Response response = new Response(getRequest().getId(), TripleConstant.TRI_VERSION);
response.setErrorMessage(status.description);
final AppResponse result = new AppResponse();
- result.setException(getThrowable(this.getTrailers()));
- result.setObjectAttachments(UnaryClientStream.this.parseMetadataToAttachmentMap(this.getTrailers()));
+ final Metadata trailers = getTrailers() == null ? getHeaders() : getTrailers();
+ result.setException(getThrowable(trailers));
+ result.setObjectAttachments(UnaryClientStream.this.parseMetadataToAttachmentMap(trailers));
response.setResult(result);
if (!result.hasException()) {
final byte code = GrpcStatus.toDubboStatus(status.code);
@@ -89,6 +90,9 @@ public class UnaryClientStream extends AbstractClientStream implements Stream {
}
private Throwable getThrowable(Metadata metadata) {
+ if (null == metadata) {
+ return null;
+ }
// second get status detail
if (!metadata.contains(TripleHeaderEnum.STATUS_DETAIL_KEY.getHeader())) {
return null;