-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] #4270
Conversation
} | ||
map.put(MeshMessageProtocolConstant.PROTOCOL_KEY_CONTENT, new String(cloudEvent.getData().toBytes(), StandardCharsets.UTF_8)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StandardCharsets.UTF_8 replace with Constants.DEFAULT_CHARSET
Codecov Report
@@ Coverage Diff @@
## master #4270 +/- ##
=========================================
Coverage 16.86% 16.87%
Complexity 1426 1426
=========================================
Files 593 593
Lines 26073 26068 -5
Branches 2401 2396 -5
=========================================
Hits 4398 4398
+ Misses 21234 21229 -5
Partials 441 441
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
case MSG_BATCH_SEND_V2: | ||
return SendMessageBatchV2ProtocolResolver.buildEvent(header, body); | ||
case MSG_SEND_SYNC: | ||
return SendMessageRequestProtocolResolver.buildEvent(header, body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 87 is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged both the Cases.
@Override | ||
public Map<String, Object> toMap() { | ||
if (cloudEvent.getData() == null) { | ||
cloudEvent.getExtension(Constants.PROTOCOL_DESC) == null ? null : cloudEvent.getExtension(Constants.PROTOCOL_DESC).toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change needs to be made in this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted back the changes (Removed few white spaces).
map.put(MeshMessageProtocolConstant.PROTOCOL_KEY_CONTENT, new String(cloudEvent.getData().toBytes(), | ||
Constants.DEFAULT_CHARSET)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider putting the second argument on the same line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this:
map.put(MeshMessageProtocolConstant.PROTOCOL_KEY_CONTENT,
new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET));
Because new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET)
is the second argument of map.put
.
Put
method doesn't have three arguments; it's the original line breaks that make it look like it has three arguments .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have put the whole second argument in the next line as suggested, thank you for the info :)
@devCod3r import code style , https://eventmesh.apache.org/community/contribute/contribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…rotocolAdaptor] (apache#4270) * [ISSUE apache#4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE apache#4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE apache#4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE apache#4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor]
* feat: add redis connector. * feat: add redis connector. * feat: add redis connector. * feat: add redis connector. * feat: add redis connector. * [ISSUE #4023]Comparison using reference equality instead of value equality.[Operation] (#4276) * [ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] (#4270) * [ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE #4269] Used switch to replace the if-else. [MeshMessageProtocolAdaptor] * [ISSUE #4099]Refactor re-used constant's usage from dedicated file (#4257) * [ISSUE #4099]: Refactor re-used constant's usage from dedicated file * [ISSUE #4099] Rename some constants for mongodb storage plugin * [ISSUE #4099] Refactor constant imports in mongodb cloud event util * [ISSUE #4099]: Replace contants imports to class import in mongo cloud event util * fix import order. * fix import order. * fix import order. * fix import order. --------- Co-authored-by: Fabian Bao <fabian.bao@agfa.com> Co-authored-by: kyooosukedn <87076947+kyooosukedn@users.noreply.github.com> Co-authored-by: Sam V Jose <124816912+devCod3r@users.noreply.github.com> Co-authored-by: ruhshan <ruhshan.ahmed@gmail.com>
…MessageProtocolAdaptor] (apache#4270)" This reverts commit 2cb5aa9.
Fixes #4269
Motivation
Replaced the if-else conditions with switch cases.
ISSUE #4269
Modifications
Describe the modifications you've done.
Replaced the if-else conditions with switch cases.
Documentation