You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/10/27 15:04:49 UTC

[incubator-eventmesh] branch master updated: Add null pointer exception

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

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


The following commit(s) were added to refs/heads/master by this push:
     new cf99b3f5 Add null pointer exception
     new 9a47cc30 Merge pull request #1982 from parvathy00/master
cf99b3f5 is described below

commit cf99b3f560fa287ea3039ac546e726b6e91924e9
Author: Parvathy Babu <pa...@thoughtworks.com>
AuthorDate: Thu Oct 27 19:14:43 2022 +0530

    Add null pointer exception
---
 .../core/protocol/http/processor/SendSyncMessageProcessor.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
index 2c8626d1..dfd79556 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendSyncMessageProcessor.java
@@ -159,8 +159,8 @@ public class SendSyncMessageProcessor implements HttpRequestProcessor {
         //do acl check
         if (eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshServerSecurityEnable) {
             String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel());
-            String user = event.getExtension(ProtocolKey.ClientInstanceKey.USERNAME).toString();
-            String pass = event.getExtension(ProtocolKey.ClientInstanceKey.PASSWD).toString();
+            String user = Objects.requireNonNull(event.getExtension(ProtocolKey.ClientInstanceKey.USERNAME)).toString();
+            String pass = Objects.requireNonNull(event.getExtension(ProtocolKey.ClientInstanceKey.PASSWD)).toString();
             int requestCode = Integer.parseInt(asyncContext.getRequest().getRequestCode());
 
             try {
@@ -192,7 +192,7 @@ public class SendSyncMessageProcessor implements HttpRequestProcessor {
             return;
         }
 
-        String content = new String(event.getData().toBytes(), StandardCharsets.UTF_8);
+        String content = new String(Objects.requireNonNull(event.getData()).toBytes(), StandardCharsets.UTF_8);
         if (content.length() > eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshEventSize) {
             httpLogger.error("Event size exceeds the limit: {}",
                 eventMeshHTTPServer.getEventMeshHttpConfiguration().eventMeshEventSize);
@@ -280,7 +280,7 @@ public class SendSyncMessageProcessor implements HttpRequestProcessor {
                                 .withExtension(EventMeshConstants.RSP_MQ2EVENTMESH_TIMESTAMP,
                                         String.valueOf(System.currentTimeMillis()))
                                 .build();
-                        final String rtnMsg = new String(event.getData().toBytes(),
+                        final String rtnMsg = new String(Objects.requireNonNull(event.getData()).toBytes(),
                                 EventMeshConstants.DEFAULT_CHARSET);
 
                         HttpCommand succ = asyncContext.getRequest().createHttpCommandResponse(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org