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

qingshanpeng 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 3bf8aedca [ISSUE #3472]Do some code optimization[HttpProtocolAdaptor] 
(#3884)
3bf8aedca is described below

commit 3bf8aedca2e32aefdf750487a452418b4e5272b3
Author: Harshitha Sudhakar 
<[email protected]>
AuthorDate: Tue May 16 08:24:56 2023 +0530

    [ISSUE #3472]Do some code optimization[HttpProtocolAdaptor] (#3884)
    
    * Update HttpRequestProtocolResolver.java
    
    Imported `java.util.Objects`
    Used 'Objects.requireNonNull()' at line 95
    
    * Update HttpRequestProtocolResolver.java
---
 .../eventmesh/protocol/http/resolver/HttpRequestProtocolResolver.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/resolver/HttpRequestProtocolResolver.java
 
b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/resolver/HttpRequestProtocolResolver.java
index 02d3e2cb0..186a74e5b 100644
--- 
a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/resolver/HttpRequestProtocolResolver.java
+++ 
b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/resolver/HttpRequestProtocolResolver.java
@@ -30,6 +30,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.UUID;
 
 import io.cloudevents.CloudEvent;
@@ -92,7 +93,7 @@ public class HttpRequestProtocolResolver {
             data.put(HttpProtocolConstant.CONSTANTS_KEY_PATH, requestURI);
             data.put(HttpProtocolConstant.CONSTANTS_KEY_METHOD, 
httpEventWrapper.getHttpMethod());
             // with data
-            return 
builder.withData(JsonUtils.toJSONString(data).getBytes(StandardCharsets.UTF_8)).build();
+            return 
builder.withData(Objects.requireNonNull(JsonUtils.toJSONString(data)).getBytes(StandardCharsets.UTF_8)).build();
         } catch (Exception e) {
             throw new ProtocolHandleException(e.getMessage(), e);
         }


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

Reply via email to