Skip to content

Commit 7f262f9

Browse files
authored
simplify map empty judgment (#3376)
1 parent 7b529a3 commit 7f262f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ public Result invoke(Invocation inv) throws RpcException {
134134
}
135135
RpcInvocation invocation = (RpcInvocation) inv;
136136
invocation.setInvoker(this);
137-
if (attachment != null && attachment.size() > 0) {
137+
if (attachment != null && !attachment.isEmpty()) {
138138
invocation.addAttachmentsIfAbsent(attachment);
139139
}
140140
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
141-
if (contextAttachments != null && contextAttachments.size() != 0) {
141+
if (contextAttachments != null && !contextAttachments.isEmpty()) {
142142
/**
143143
* invocation.addAttachmentsIfAbsent(context){@link RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
144144
* because the {@link RpcContext#setAttachment(String, String)} is passed in the Filter when the call is triggered

0 commit comments

Comments
 (0)