Skip to content

Commit a074319

Browse files
authored
follow up for #3376 (#3377)
1 parent 47abf6c commit a074319

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractInvoker.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.dubbo.common.logger.Logger;
2323
import org.apache.dubbo.common.logger.LoggerFactory;
2424
import org.apache.dubbo.common.utils.ArrayUtils;
25+
import org.apache.dubbo.common.utils.CollectionUtils;
2526
import org.apache.dubbo.common.utils.NetUtils;
2627
import org.apache.dubbo.rpc.Invocation;
2728
import org.apache.dubbo.rpc.Invoker;
@@ -134,11 +135,11 @@ public Result invoke(Invocation inv) throws RpcException {
134135
}
135136
RpcInvocation invocation = (RpcInvocation) inv;
136137
invocation.setInvoker(this);
137-
if (attachment != null && !attachment.isEmpty()) {
138+
if (CollectionUtils.isNotEmptyMap(attachment)) {
138139
invocation.addAttachmentsIfAbsent(attachment);
139140
}
140141
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
141-
if (contextAttachments != null && !contextAttachments.isEmpty()) {
142+
if (CollectionUtils.isNotEmptyMap(contextAttachments)) {
142143
/**
143144
* invocation.addAttachmentsIfAbsent(context){@link RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
144145
* because the {@link RpcContext#setAttachment(String, String)} is passed in the Filter when the call is triggered

0 commit comments

Comments
 (0)