Skip to content

Commit

Permalink
simplify map empty judgment (#3376)
Browse files Browse the repository at this point in the history
  • Loading branch information
zonghaishang authored Jan 29, 2019
1 parent 7b529a3 commit 7f262f9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ public Result invoke(Invocation inv) throws RpcException {
}
RpcInvocation invocation = (RpcInvocation) inv;
invocation.setInvoker(this);
if (attachment != null && attachment.size() > 0) {
if (attachment != null && !attachment.isEmpty()) {
invocation.addAttachmentsIfAbsent(attachment);
}
Map<String, String> contextAttachments = RpcContext.getContext().getAttachments();
if (contextAttachments != null && contextAttachments.size() != 0) {
if (contextAttachments != null && !contextAttachments.isEmpty()) {
/**
* invocation.addAttachmentsIfAbsent(context){@link RpcInvocation#addAttachmentsIfAbsent(Map)}should not be used here,
* because the {@link RpcContext#setAttachment(String, String)} is passed in the Filter when the call is triggered
Expand Down

0 comments on commit 7f262f9

Please sign in to comment.