This is an automated email from the ASF dual-hosted git repository.

pandaapo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cb170420 [ISSUE #3472]Do some code optimization[HttpProtocolAdaptor] 
(#3883)
9cb170420 is described below

commit 9cb1704203f8483964a7c0deab3931721b4a4f6f
Author: Harshitha Sudhakar 
<[email protected]>
AuthorDate: Sun Nov 12 15:33:05 2023 +0530

    [ISSUE #3472]Do some code optimization[HttpProtocolAdaptor] (#3883)
    
    * Update HttpProtocolAdaptor.java
    
    1.
    imported `java.util.Collections`
    returns `Collections.emptyList()` at line 81.
    
    2. Used `Objects.requireNonNull()` at line 103
    
    * Update HttpProtocolAdaptor.java
---
 .../java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java
 
b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java
index bb422f499..a232781ff 100644
--- 
a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java
+++ 
b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java
@@ -32,6 +32,7 @@ import 
org.apache.eventmesh.protocol.api.exception.ProtocolHandleException;
 import org.apache.eventmesh.protocol.http.resolver.HttpRequestProtocolResolver;
 
 import java.nio.charset.StandardCharsets;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -77,7 +78,7 @@ public class HttpProtocolAdaptor<T extends 
ProtocolTransportObject>
     @Override
     public List<CloudEvent> toBatchCloudEvent(ProtocolTransportObject protocol)
         throws ProtocolHandleException {
-        return null;
+        return Collections.emptyList();
     }
 
     @Override
@@ -98,7 +99,7 @@ public class HttpProtocolAdaptor<T extends 
ProtocolTransportObject>
         // ce data
         if (null != cloudEvent.getData()) {
             Map<String, Object> dataContentMap = 
JsonUtils.parseTypeReferenceObject(
-                new String(cloudEvent.getData().toBytes(), 
Constants.DEFAULT_CHARSET),
+                new 
String(Objects.requireNonNull(cloudEvent.getData()).toBytes(), 
Constants.DEFAULT_CHARSET),
                 new TypeReference<Map<String, Object>>() {
                 });
             String requestHeader = JsonUtils.toJSONString(


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

Reply via email to