You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2022/10/28 07:53:57 UTC

[GitHub] [incubator-eventmesh] xwm1992 commented on a diff in pull request #1991: [ISSUE #1992] Possible null pointer dereference due to return value of called method [SendMessageRequestProtocolResolver]

xwm1992 commented on code in PR #1991:
URL: https://github.com/apache/incubator-eventmesh/pull/1991#discussion_r1007763601


##########
eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/http/SendMessageRequestProtocolResolver.java:
##########
@@ -62,6 +62,10 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
 
             CloudEvent event = null;
             if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
+                if(EventFormatProvider.getInstance() == null ||

Review Comment:
   please use `Object.requireNonNull` instead of return `null`



##########
eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/http/SendMessageRequestProtocolResolver.java:
##########
@@ -81,6 +85,10 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
                         .withExtension(SendMessageRequestBody.PRODUCERGROUP, producerGroup)
                         .build();
             } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
+                if(EventFormatProvider.getInstance() == null ||

Review Comment:
   same as above



-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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