You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "Orcohen33 (via GitHub)" <gi...@apache.org> on 2023/03/29 12:24:54 UTC

[GitHub] [eventmesh] Orcohen33 opened a new pull request, #3557: Fixed issue with 'Objects.requireNonNull()' where getData() can return null

Orcohen33 opened a new pull request, #3557:
URL: https://github.com/apache/eventmesh/pull/3557

   Fixes #3410.
   
   ### Motivation
   
   The issue was that the getData() method in SendAsyncEventProcessor could return null, which could cause a NullPointerException to be thrown. 
   To prevent this, the suggested solution is to use Objects.requireNonNull().
   
   
   
   ### Modifications
   
   The modification made to the code was to add a call to Objects.requireNonNull() around the getData() method call in SendAsyncEventProcessor. This ensures that if getData() returns null, a NullPointerException will be thrown immediately, making it easier to locate and fix the issue.
   
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (no)
   - If yes, how is the feature documented? (n/a)
   - If a feature is not applicable for documentation, explain why? (n/a)
   - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation (n/a)
   


-- 
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


[GitHub] [eventmesh] mytang0 merged pull request #3557: Fixed issue with 'Objects.requireNonNull()' where getData() can return null

Posted by "mytang0 (via GitHub)" <gi...@apache.org>.
mytang0 merged PR #3557:
URL: https://github.com/apache/eventmesh/pull/3557


-- 
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


[GitHub] [eventmesh] Orcohen33 commented on a diff in pull request #3557: Fixed issue with 'Objects.requireNonNull()' where getData() can return null

Posted by "Orcohen33 (via GitHub)" <gi...@apache.org>.
Orcohen33 commented on code in PR #3557:
URL: https://github.com/apache/eventmesh/pull/3557#discussion_r1151884834


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendAsyncEventProcessor.java:
##########
@@ -212,7 +212,7 @@ public void handler(final HandlerService.HandlerSpecific handlerSpecific, final
             return;
         }
 
-        final String content = new String(event.getData().toBytes(), StandardCharsets.UTF_8);
+        final String content = new String(Objects.requireNonNull(event.getData().toBytes()), StandardCharsets.UTF_8);

Review Comment:
   Done



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

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


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


[GitHub] [eventmesh] mxsm commented on a diff in pull request #3557: Fixed issue with 'Objects.requireNonNull()' where getData() can return null

Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #3557:
URL: https://github.com/apache/eventmesh/pull/3557#discussion_r1151879950


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/SendAsyncEventProcessor.java:
##########
@@ -212,7 +212,7 @@ public void handler(final HandlerService.HandlerSpecific handlerSpecific, final
             return;
         }
 
-        final String content = new String(event.getData().toBytes(), StandardCharsets.UTF_8);
+        final String content = new String(Objects.requireNonNull(event.getData().toBytes()), StandardCharsets.UTF_8);

Review Comment:
   modify like this: `final String content = new String(Objects.requireNonNull(event.getData()).toBytes(), StandardCharsets.UTF_8);
   `



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

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


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