devCod3r commented on code in PR #4270:
URL: https://github.com/apache/eventmesh/pull/4270#discussion_r1270897135


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/MeshMessageProtocolAdaptor.java:
##########
@@ -108,31 +107,33 @@ public List<CloudEvent> 
toBatchCloudEvent(ProtocolTransportObject protocol) thro
     public ProtocolTransportObject fromCloudEvent(CloudEvent cloudEvent) 
throws ProtocolHandleException {
         validateCloudEvent(cloudEvent);
         String protocolDesc =
-            cloudEvent.getExtension(Constants.PROTOCOL_DESC) == null ? null : 
cloudEvent.getExtension(Constants.PROTOCOL_DESC).toString();
-
-        if (StringUtils.equals(MeshMessageProtocolConstant.PROTOCOL_DESC_HTTP, 
protocolDesc)) {
-            HttpCommand httpCommand = new HttpCommand();
-            Body body = new Body() {
-                final Map<String, Object> map = new HashMap<>();
-
-                @Override
-                public Map<String, Object> toMap() {
-                    if (cloudEvent.getData() == null) {
+                cloudEvent.getExtension(Constants.PROTOCOL_DESC) == null ? 
null : cloudEvent.getExtension(Constants.PROTOCOL_DESC).toString();
+
+        switch (Objects.requireNonNull(protocolDesc)) {
+            case MeshMessageProtocolConstant.PROTOCOL_DESC_HTTP:
+                HttpCommand httpCommand = new HttpCommand();
+                Body body = new Body() {
+                    final Map<String, Object> map = new HashMap<>();
+
+                    @Override
+                    public Map<String, Object> toMap() {
+                        if (cloudEvent.getData() == null) {
+                            return map;
+                        }
+                        
map.put(MeshMessageProtocolConstant.PROTOCOL_KEY_CONTENT, new 
String(cloudEvent.getData().toBytes(),
+                                Constants.DEFAULT_CHARSET));

Review Comment:
   The second argument is on the same line but when I tried to put all the 3 
arguments in the same line, I got the warning as shown below:
   <img width="320" alt="image" 
src="https://github.com/apache/eventmesh/assets/124816912/acd33f5d-66eb-4e58-ac9b-dbe86cfece39";>
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to