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

[GitHub] [incubator-eventmesh] mxsm commented on a diff in pull request #3374: [ISSUE #2972] Require null check

mxsm commented on code in PR #3374:
URL: https://github.com/apache/incubator-eventmesh/pull/3374#discussion_r1130299837


##########
eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/producer/CloudEventProducer.java:
##########
@@ -75,7 +76,7 @@ private void validateCloudEvent(final CloudEvent cloudEvent) {
 
     private RequestParam buildCommonPostParam(final CloudEvent cloudEvent) {
         validateCloudEvent(cloudEvent);
-        final byte[] bodyByte = EventFormatProvider.getInstance().resolveFormat(cloudEvent.getDataContentType())
+        final byte[] bodyByte = Objects.requireNonNull(EventFormatProvider.getInstance().resolveFormat(cloudEvent.getDataContentType()))
             .serialize(cloudEvent);
         final String content = new String(bodyByte, StandardCharsets.UTF_8);

Review Comment:
   how about this place change to 
   ```java
   final String content = new String(bodyByte, Constants.DEFAULT_CHARSET);
   ```



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